Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/LocationSelect.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 | 1a7cfeb1ff89 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
32 * | 32 * |
33 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 33 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
34 */ | 34 */ |
35 public class LocationSelect extends LocationDistanceSelect { | 35 public class LocationSelect extends LocationDistanceSelect { |
36 | 36 |
37 /** The logger used in this class.*/ | 37 /** The log used in this class.*/ |
38 private static Logger logger = Logger.getLogger(LocationSelect.class); | 38 private static Logger log = Logger.getLogger(LocationSelect.class); |
39 | 39 |
40 | 40 |
41 public LocationSelect() { | 41 public LocationSelect() { |
42 } | 42 } |
43 | 43 |
64 if (minmax != null) { | 64 if (minmax != null) { |
65 minVal = minmax[0]; | 65 minVal = minmax[0]; |
66 maxVal = minmax[1]; | 66 maxVal = minmax[1]; |
67 } | 67 } |
68 else { | 68 else { |
69 logger.warn("Could not read min/max distance values!"); | 69 log.warn("Could not read min/max distance values!"); |
70 } | 70 } |
71 | 71 |
72 if (name.equals(LOCATIONS)) { | 72 if (name.equals(LOCATIONS)) { |
73 Element min = createItem( | 73 Element min = createItem( |
74 cr, | 74 cr, |
88 /** Validates data from artifact. */ | 88 /** Validates data from artifact. */ |
89 @Override | 89 @Override |
90 public boolean validate(Artifact artifact) | 90 public boolean validate(Artifact artifact) |
91 throws IllegalArgumentException | 91 throws IllegalArgumentException |
92 { | 92 { |
93 logger.debug("LocationSelect.validate"); | 93 log.debug("LocationSelect.validate"); |
94 | 94 |
95 D4EArtifact flys = (D4EArtifact) artifact; | 95 D4EArtifact flys = (D4EArtifact) artifact; |
96 StateData data = getData(flys, LOCATIONS); | 96 StateData data = getData(flys, LOCATIONS); |
97 | 97 |
98 String locationStr = data != null | 98 String locationStr = data != null |
99 ? (String) data.getValue() | 99 ? (String) data.getValue() |
100 : null; | 100 : null; |
101 | 101 |
102 if (locationStr == null || locationStr.length() == 0) { | 102 if (locationStr == null || locationStr.length() == 0) { |
103 logger.error("No locations given."); | 103 log.error("No locations given."); |
104 throw new IllegalArgumentException("error_empty_state"); | 104 throw new IllegalArgumentException("error_empty_state"); |
105 } | 105 } |
106 | 106 |
107 double[] minmax = getMinMax(artifact); | 107 double[] minmax = getMinMax(artifact); |
108 double[] mm = extractLocations(locationStr); | 108 double[] mm = extractLocations(locationStr); |
109 | 109 |
110 logger.debug("Inserted min location: " + mm[0]); | 110 log.debug("Inserted min location: " + mm[0]); |
111 logger.debug("Inserted max location: " + mm[mm.length-1]); | 111 log.debug("Inserted max location: " + mm[mm.length-1]); |
112 | 112 |
113 return validateBounds(minmax[0], minmax[1], mm[0], mm[mm.length-1], 0d); | 113 return validateBounds(minmax[0], minmax[1], mm[0], mm[mm.length-1], 0d); |
114 } | 114 } |
115 | 115 |
116 | 116 |
129 for (String l: tmp) { | 129 for (String l: tmp) { |
130 try { | 130 try { |
131 locations.add(Double.parseDouble(l)); | 131 locations.add(Double.parseDouble(l)); |
132 } | 132 } |
133 catch (NumberFormatException nfe) { | 133 catch (NumberFormatException nfe) { |
134 logger.warn(nfe, nfe); | 134 log.warn(nfe, nfe); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 locations.sort(); | 138 locations.sort(); |
139 | 139 |