comparison artifacts/src/main/java/org/dive4elements/river/artifacts/WQKmsInterpolArtifact.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 8d5ca5175038
children 0a5239a1e46e
comparison
equal deleted inserted replaced
8201:4b8c5a08de04 8202:e4606eae8ea5
45 */ 45 */
46 public class WQKmsInterpolArtifact 46 public class WQKmsInterpolArtifact
47 extends StaticD4EArtifact 47 extends StaticD4EArtifact
48 implements FacetTypes 48 implements FacetTypes
49 { 49 {
50 /** The logger for this class. */ 50 /** The log for this class. */
51 private static Logger logger = 51 private static Logger log =
52 Logger.getLogger(WQKmsInterpolArtifact.class); 52 Logger.getLogger(WQKmsInterpolArtifact.class);
53 53
54 /** State name. */ 54 /** State name. */
55 public static final String STATIC_STATE_NAME = 55 public static final String STATIC_STATE_NAME =
56 "state.additional_wqkms.interpol.static"; 56 "state.additional_wqkms.interpol.static";
70 70
71 /** 71 /**
72 * Trivial Constructor. 72 * Trivial Constructor.
73 */ 73 */
74 public WQKmsInterpolArtifact() { 74 public WQKmsInterpolArtifact() {
75 logger.debug("WQKmsInterpolArtifact.WQKmsInterpolArtifact"); 75 log.debug("WQKmsInterpolArtifact.WQKmsInterpolArtifact");
76 } 76 }
77 77
78 78
79 /** Return fixed artifact (types) name. */ 79 /** Return fixed artifact (types) name. */
80 @Override 80 @Override
93 Object context, 93 Object context,
94 CallMeta callMeta, 94 CallMeta callMeta,
95 Document data, 95 Document data,
96 List<Class> loadFacets) 96 List<Class> loadFacets)
97 { 97 {
98 logger.debug("WQKmsInterpolArtifact.setup"); 98 log.debug("WQKmsInterpolArtifact.setup");
99 99
100 state = new StaticState(STATIC_STATE_NAME); 100 state = new StaticState(STATIC_STATE_NAME);
101 101
102 List<Facet> fs = new ArrayList<Facet>(); 102 List<Facet> fs = new ArrayList<Facet>();
103 String code = getDatacageIDValue(data); 103 String code = getDatacageIDValue(data);
105 // TODO Go for JSON, one day. 105 // TODO Go for JSON, one day.
106 //ex.: flood_protection-wstv-114-12 106 //ex.: flood_protection-wstv-114-12
107 if (code != null) { 107 if (code != null) {
108 String [] parts = code.split("-"); 108 String [] parts = code.split("-");
109 109
110 logger.debug("WQKmsInterpolArtifact.setup: code " + code); 110 log.debug("WQKmsInterpolArtifact.setup: code " + code);
111 111
112 if (parts.length >= 4) { 112 if (parts.length >= 4) {
113 int wst = Integer.parseInt(parts[3]); 113 int wst = Integer.parseInt(parts[3]);
114 int col = -1; 114 int col = -1;
115 String colpos = parts[2]; 115 String colpos = parts[2];
152 fs.add(wQFacet); 152 fs.add(wQFacet);
153 addFacets(state.getID(), fs); 153 addFacets(state.getID(), fs);
154 } 154 }
155 } 155 }
156 else { 156 else {
157 logger.warn("WQKmsInterpolArtifact: no code"); 157 log.warn("WQKmsInterpolArtifact: no code");
158 } 158 }
159 159
160 spawnState(); 160 spawnState();
161 super.setup(identifier, factory, context, callMeta, data, loadFacets); 161 super.setup(identifier, factory, context, callMeta, data, loadFacets);
162 } 162 }
191 protected void initialize( 191 protected void initialize(
192 Artifact artifact, 192 Artifact artifact,
193 Object context, 193 Object context,
194 CallMeta meta) 194 CallMeta meta)
195 { 195 {
196 logger.debug("WQKmsInterpolArtifact.initialize"); 196 log.debug("WQKmsInterpolArtifact.initialize");
197 D4EArtifact winfo = (D4EArtifact) artifact; 197 D4EArtifact winfo = (D4EArtifact) artifact;
198 importData(winfo, "river"); 198 importData(winfo, "river");
199 importData(winfo, "ld_locations"); 199 importData(winfo, "ld_locations");
200 } 200 }
201 201
265 265
266 double [][] vs = interpolator.interpolateWQColumnwise( 266 double [][] vs = interpolator.interpolateWQColumnwise(
267 tmp != null ? tmp : 0); 267 tmp != null ? tmp : 0);
268 268
269 for (int x = 0; x < vs[1].length; x++) { 269 for (int x = 0; x < vs[1].length; x++) {
270 logger.debug("getWQAtKm: Q/W " + vs[0][x] + " / " + vs[1][x]); 270 log.debug("getWQAtKm: Q/W " + vs[0][x] + " / " + vs[1][x]);
271 } 271 }
272 272
273 return vs; 273 return vs;
274 } 274 }
275 275
281 String val = getDataAsString(dataName); 281 String val = getDataAsString(dataName);
282 try { 282 try {
283 return Integer.parseInt(val); 283 return Integer.parseInt(val);
284 } 284 }
285 catch (NumberFormatException e) { 285 catch (NumberFormatException e) {
286 logger.warn("Could not get data " + dataName + " as int", e); 286 log.warn("Could not get data " + dataName + " as int", e);
287 return 0; 287 return 0;
288 } 288 }
289 } 289 }
290 290
291 291
327 * Get WQKms from factory. 327 * Get WQKms from factory.
328 * @param idx param is not needed (TODO) 328 * @param idx param is not needed (TODO)
329 * @return WQKms according to parameterization (can be null); 329 * @return WQKms according to parameterization (can be null);
330 */ 330 */
331 public WQKms getWQKms(int idx) { 331 public WQKms getWQKms(int idx) {
332 logger.debug("WQKmsInterpolArtifact.getWQKms"); 332 log.debug("WQKmsInterpolArtifact.getWQKms");
333 logger.warn("Stub, getWQKms not yet implemented."); 333 log.warn("Stub, getWQKms not yet implemented.");
334 334
335 return WQKmsFactory.getWQKms( 335 return WQKmsFactory.getWQKms(
336 Integer.parseInt(getDataAsString("col_pos")), 336 Integer.parseInt(getDataAsString("col_pos")),
337 Integer.parseInt(getDataAsString("wst_id"))); 337 Integer.parseInt(getDataAsString("wst_id")));
338 } 338 }

http://dive4elements.wald.intevation.org