comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/LocationDistanceSelect.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 e3e5d6bb4902
comparison
equal deleted inserted replaced
8201:4b8c5a08de04 8202:e4606eae8ea5
25 */ 25 */
26 public class LocationDistanceSelect 26 public class LocationDistanceSelect
27 extends ComputationRangeState 27 extends ComputationRangeState
28 { 28 {
29 29
30 /** The logger used in this class. */ 30 /** The log used in this class. */
31 private static Logger logger = Logger.getLogger(LocationDistanceSelect.class); 31 private static Logger log = Logger.getLogger(LocationDistanceSelect.class);
32 32
33 /** The name of the 'mode' field. */ 33 /** The name of the 'mode' field. */
34 public static final String MODE = "ld_mode"; 34 public static final String MODE = "ld_mode";
35 35
36 /** The name of the 'locations' field. */ 36 /** The name of the 'locations' field. */
53 /** Validates the range (or location). */ 53 /** Validates the range (or location). */
54 @Override 54 @Override
55 public boolean validate(Artifact artifact) 55 public boolean validate(Artifact artifact)
56 throws IllegalArgumentException 56 throws IllegalArgumentException
57 { 57 {
58 logger.debug("LocationDistanceSelect.validate"); 58 log.debug("LocationDistanceSelect.validate");
59 59
60 D4EArtifact flys = (D4EArtifact)artifact; 60 D4EArtifact flys = (D4EArtifact)artifact;
61 StateData mode = getData(flys, MODE); 61 StateData mode = getData(flys, MODE);
62 String mValue = mode != null ? (String)mode.getValue() : null; 62 String mValue = mode != null ? (String)mode.getValue() : null;
63 if (mValue != null) { 63 if (mValue != null) {
136 public static double[] getLocations(WINFOArtifact flys) { 136 public static double[] getLocations(WINFOArtifact flys) {
137 StateData data = flys.getData(LOCATIONS); 137 StateData data = flys.getData(LOCATIONS);
138 String value = data != null ? (String) data.getValue() : null; 138 String value = data != null ? (String) data.getValue() : null;
139 139
140 if (value == null || value.length() == 0) { 140 if (value == null || value.length() == 0) {
141 logger.warn("No location data given."); 141 log.warn("No location data given.");
142 return null; 142 return null;
143 } 143 }
144 144
145 String[] splitted = value.split(" "); 145 String[] splitted = value.split(" ");
146 TDoubleArrayList values = new TDoubleArrayList(); 146 TDoubleArrayList values = new TDoubleArrayList();
148 for (String split: splitted) { 148 for (String split: splitted) {
149 try { 149 try {
150 values.add(Double.valueOf(split)); 150 values.add(Double.valueOf(split));
151 } 151 }
152 catch (NumberFormatException nfe) { 152 catch (NumberFormatException nfe) {
153 logger.warn(nfe, nfe); 153 log.warn(nfe, nfe);
154 } 154 }
155 } 155 }
156 156
157 return values.toNativeArray(); 157 return values.toNativeArray();
158 } 158 }

http://dive4elements.wald.intevation.org