Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/services/CrossSectionKMService.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | af13ceeba52a |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
57 * result in [4,5,7,8,9]). | 57 * result in [4,5,7,8,9]). |
58 */ | 58 */ |
59 public class CrossSectionKMService | 59 public class CrossSectionKMService |
60 extends D4EService | 60 extends D4EService |
61 { | 61 { |
62 private static Logger logger = | 62 private static Logger log = |
63 Logger.getLogger(CrossSectionKMService.class); | 63 Logger.getLogger(CrossSectionKMService.class); |
64 | 64 |
65 public static final String CACHE_NAME = "cross-section-kms"; | 65 public static final String CACHE_NAME = "cross-section-kms"; |
66 | 66 |
67 | 67 |
77 public Document doProcess( | 77 public Document doProcess( |
78 Document data, | 78 Document data, |
79 GlobalContext globalContext, | 79 GlobalContext globalContext, |
80 CallMeta callMeta | 80 CallMeta callMeta |
81 ) { | 81 ) { |
82 logger.debug("CrossSectionKMService.doProcess"); | 82 log.debug("CrossSectionKMService.doProcess"); |
83 | 83 |
84 NodeList crossSectionNodes = | 84 NodeList crossSectionNodes = |
85 data.getElementsByTagName("art:cross-section"); | 85 data.getElementsByTagName("art:cross-section"); |
86 | 86 |
87 Document document = XMLUtils.newDocument(); | 87 Document document = XMLUtils.newDocument(); |
94 String idString = crossSectionElement.getAttribute("id"); | 94 String idString = crossSectionElement.getAttribute("id"); |
95 String kmString = crossSectionElement.getAttribute("km"); | 95 String kmString = crossSectionElement.getAttribute("km"); |
96 String neighborsString = crossSectionElement.getAttribute("n"); | 96 String neighborsString = crossSectionElement.getAttribute("n"); |
97 | 97 |
98 if (idString.length() == 0 || kmString.length() == 0) { | 98 if (idString.length() == 0 || kmString.length() == 0) { |
99 logger.debug("missing attributes in cross-section element"); | 99 log.debug("missing attributes in cross-section element"); |
100 continue; | 100 continue; |
101 } | 101 } |
102 | 102 |
103 double km; | 103 double km; |
104 Integer crossSectionId; | 104 Integer crossSectionId; |
111 if (neighborsString.length() > 0) { | 111 if (neighborsString.length() > 0) { |
112 N = Integer.parseInt(neighborsString); | 112 N = Integer.parseInt(neighborsString); |
113 } | 113 } |
114 } | 114 } |
115 catch (NumberFormatException nfe) { | 115 catch (NumberFormatException nfe) { |
116 logger.debug("converting number failed", nfe); | 116 log.debug("converting number failed", nfe); |
117 continue; | 117 continue; |
118 } | 118 } |
119 | 119 |
120 NavigableMap<Double, Integer> map = getKms(crossSectionId); | 120 NavigableMap<Double, Integer> map = getKms(crossSectionId); |
121 | 121 |
122 if (map == null) { | 122 if (map == null) { |
123 logger.debug("cannot find cross section " + crossSectionId); | 123 log.debug("cannot find cross section " + crossSectionId); |
124 continue; | 124 continue; |
125 } | 125 } |
126 | 126 |
127 Deque<Map.Entry<Double, Integer>> result = | 127 Deque<Map.Entry<Double, Integer>> result = |
128 nearestNeighbors(map, km, N); | 128 nearestNeighbors(map, km, N); |