Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java @ 8856:5e38e2924c07 3.2.x
Fix code style.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:12:01 +0100 |
parents | a5e450af498b |
children | f972e1da4a63 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8855:d7c005e12af0 | 8856:5e38e2924c07 |
---|---|
49 | 49 |
50 | 50 |
51 /** | 51 /** |
52 * Static helper methods to e.g. access D4EArtifacts data. | 52 * Static helper methods to e.g. access D4EArtifacts data. |
53 * | 53 * |
54 * @deprecated Don't use RiverUtils to get data from an {@link Artifact} anymore. | 54 * @deprecated Don't use RiverUtils to get data from an |
55 * {@link Artifact} anymore. | |
55 * Instead use and/or create a {@link Access} class hierarchy. | 56 * Instead use and/or create a {@link Access} class hierarchy. |
56 **/ | 57 **/ |
57 @Deprecated | 58 @Deprecated |
58 public class RiverUtils { | 59 public class RiverUtils { |
59 | 60 |
60 /** The log that is used in this utility. */ | 61 /** The log that is used in this utility. */ |
61 private static Logger log = Logger.getLogger(RiverUtils.class); | 62 private static Logger log = Logger.getLogger(RiverUtils.class); |
62 | 63 |
63 /** | 64 /** |
64 * An enum that represents the 5 possible WQ modes in FLYS. The 5 values are | 65 * Enum that represents the 5 possible WQ modes in FLYS. The 5 values are |
65 * <i>QFREE</i> <i>QGAUGE</i> <i>WGAUGE</i> <i>WFREE</i> and <i>NONE</i>. | 66 * <i>QFREE</i> <i>QGAUGE</i> <i>WGAUGE</i> <i>WFREE</i> and <i>NONE</i>. |
66 */ | 67 */ |
67 public static enum WQ_MODE { QFREE, QGAUGE, WFREE, WGAUGE, NONE }; | 68 public static enum WQ_MODE { QFREE, QGAUGE, WFREE, WGAUGE, NONE }; |
68 | 69 |
69 /** | 70 /** |
270 String locationStr = flys.getDataAsString("ld_locations"); | 271 String locationStr = flys.getDataAsString("ld_locations"); |
271 | 272 |
272 if (locationStr == null || locationStr.length() == 0) { | 273 if (locationStr == null || locationStr.length() == 0) { |
273 if (flys instanceof WINFOArtifact) { | 274 if (flys instanceof WINFOArtifact) { |
274 WINFOArtifact winfo = (WINFOArtifact) flys; | 275 WINFOArtifact winfo = (WINFOArtifact) flys; |
275 if (winfo.getReferenceStartKm() != null && winfo.getReferenceEndKms() != null) { | 276 if (winfo.getReferenceStartKm() != null |
277 && winfo.getReferenceEndKms() != null | |
278 ) { | |
276 return new double[] | 279 return new double[] |
277 { | 280 { |
278 winfo.getReferenceStartKm().doubleValue(), | 281 winfo.getReferenceStartKm().doubleValue(), |
279 winfo.getReferenceEndKms()[0] | 282 winfo.getReferenceEndKms()[0] |
280 }; | 283 }; |
587 List<MainValue> mainValues = gauge.getMainValues(); | 590 List<MainValue> mainValues = gauge.getMainValues(); |
588 log.debug("Search named main value for: " + value); | 591 log.debug("Search named main value for: " + value); |
589 | 592 |
590 for (MainValue mv: mainValues) { | 593 for (MainValue mv: mainValues) { |
591 if (mv.getValue().doubleValue() == value) { | 594 if (mv.getValue().doubleValue() == value) { |
592 log.debug("Found named main value: " + mv.getMainValue().getName()); | 595 log.debug("Found named main value: " |
596 + mv.getMainValue().getName()); | |
593 return mv.getMainValue().getName(); | 597 return mv.getMainValue().getName(); |
594 } | 598 } |
595 } | 599 } |
596 | 600 |
597 log.debug("Did not find a named main value for: " + value); | 601 log.debug("Did not find a named main value for: " + value); |
693 } | 697 } |
694 | 698 |
695 String diffs = ""; | 699 String diffs = ""; |
696 for(int i = 0; i < datas.length; i+=2) { | 700 for(int i = 0; i < datas.length; i+=2) { |
697 // e.g.: | 701 // e.g.: |
698 // 42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1 | 702 //42537f1e-3522-42ef-8968-635b03d8e9c6;longitudinal_section.w;1 |
699 WKms minuendWKms = wState.getWKms(StringUtil.unbracket(datas[i+0]), | 703 WKms minuendWKms = wState.getWKms( |
704 StringUtil.unbracket(datas[i + 0]), | |
700 context, 0, 0); | 705 context, 0, 0); |
701 WKms subtrahendWKms = wState.getWKms(StringUtil.unbracket(datas[i+1]), | 706 WKms subtrahendWKms = wState.getWKms( |
707 StringUtil.unbracket(datas[i + 1]), | |
702 context, 0, 0); | 708 context, 0, 0); |
703 if (minuendWKms != null && subtrahendWKms != null) { | 709 if (minuendWKms != null && subtrahendWKms != null) { |
704 diffs += StringUtil.wWrap(minuendWKms.getName()) | 710 diffs += StringUtil.wWrap(minuendWKms.getName()) |
705 + " - " + StringUtil.wWrap(subtrahendWKms.getName()); | 711 + " - " + StringUtil.wWrap(subtrahendWKms.getName()); |
706 } | 712 } |