Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelData.java @ 8883:a536e1aacf0f
Further work on SINFO-FlowDepth
author | gernotbelger |
---|---|
date | Fri, 09 Feb 2018 18:07:22 +0100 |
parents | 6b93a2498e06 |
children | d9dbf0b74bc2 |
comparison
equal
deleted
inserted
replaced
8882:f762fadc5313 | 8883:a536e1aacf0f |
---|---|
21 public class WaterlevelData { | 21 public class WaterlevelData { |
22 private final WKms wkms; | 22 private final WKms wkms; |
23 | 23 |
24 private final String name; | 24 private final String name; |
25 | 25 |
26 private final int year; | |
27 | |
26 /** If <code>true</code>, tabular export will show gauges for every station, else only for the first gauge */ | 28 /** If <code>true</code>, tabular export will show gauges for every station, else only for the first gauge */ |
27 private final boolean showAllGauges; | 29 private final boolean showAllGauges; |
28 | 30 |
29 public WaterlevelData(final WKms wkms) { | 31 public WaterlevelData(final WKms wkms, final int year) { |
30 this(wkms, false); | 32 this(wkms, year, false); |
31 } | 33 } |
32 | 34 |
33 public WaterlevelData(final WKms wkms, final boolean showAllGauges) { | 35 public WaterlevelData(final WKms wkms, final int year, final boolean showAllGauges) { |
34 this(null, wkms, showAllGauges); | 36 this(null, wkms, year, showAllGauges); |
35 } | 37 } |
36 | 38 |
37 public WaterlevelData(final String name, final WKms wkms, final boolean showAllGauges) { | 39 private WaterlevelData(final String name, final WKms wkms, final int year, final boolean showAllGauges) { |
38 this.name = name; | 40 this.name = name; |
39 this.wkms = wkms; | 41 this.wkms = wkms; |
42 this.year = year; | |
40 this.showAllGauges = showAllGauges; | 43 this.showAllGauges = showAllGauges; |
41 } | 44 } |
42 | 45 |
43 public WaterlevelData filterByRange(final double from, final double to) { | 46 public WaterlevelData filterByRange(final double from, final double to) { |
44 if (Double.isNaN(from) || Double.isNaN(to)) { | 47 if (Double.isNaN(from) || Double.isNaN(to)) { |
45 return this; | 48 return this; |
46 } | 49 } |
47 | 50 |
48 final WKms filteredWkms = this.wkms.filteredKms(from, to); | 51 final WKms filteredWkms = this.wkms.filteredKms(from, to); |
49 return new WaterlevelData(filteredWkms); | 52 return new WaterlevelData(this.name, filteredWkms, this.year, this.showAllGauges); |
50 } | 53 } |
51 | 54 |
52 public WaterlevelData withName(final String nameToSet) { | 55 public WaterlevelData withName(final String nameToSet) { |
53 return new WaterlevelData(nameToSet, this.wkms, this.showAllGauges); | 56 return new WaterlevelData(nameToSet, this.wkms, this.year, this.showAllGauges); |
54 } | 57 } |
55 | 58 |
56 public String getName() { | 59 public String getName() { |
57 return this.name; | 60 return this.name; |
58 } | 61 } |
79 if (waterIncreasing) | 82 if (waterIncreasing) |
80 return new double[] { to, from }; | 83 return new double[] { to, from }; |
81 | 84 |
82 return new double[] { from, to }; | 85 return new double[] { from, to }; |
83 } | 86 } |
87 | |
88 public int getYear() { | |
89 return this.year; | |
90 } | |
84 } | 91 } |