Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensity.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 | e4606eae8ea5 |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8855:d7c005e12af0 | 8856:5e38e2924c07 |
---|---|
70 } | 70 } |
71 | 71 |
72 private static final Comparator<SedimentDensityValue> BY_KM = | 72 private static final Comparator<SedimentDensityValue> BY_KM = |
73 new Comparator<SedimentDensityValue>() { | 73 new Comparator<SedimentDensityValue>() { |
74 @Override | 74 @Override |
75 public int compare(SedimentDensityValue a, SedimentDensityValue b) { | 75 public int compare( |
76 SedimentDensityValue a, | |
77 SedimentDensityValue b | |
78 ) { | |
76 double diff = a.getKm() - b.getKm(); | 79 double diff = a.getKm() - b.getKm(); |
77 if (diff < 0.0) return -1; | 80 if (diff < 0.0) return -1; |
78 if (diff > 0.0) return +1; | 81 if (diff > 0.0) return +1; |
79 return 0; | 82 return 0; |
80 } | 83 } |
118 if (densities.isEmpty()) { | 121 if (densities.isEmpty()) { |
119 return SEDIMNET_DENSITY_FACTOR; | 122 return SEDIMNET_DENSITY_FACTOR; |
120 } | 123 } |
121 | 124 |
122 if (densities.size() == 1) { | 125 if (densities.size() == 1) { |
123 Map.Entry<Integer, List<SedimentDensityValue>> entry = densities.firstEntry(); | 126 Map.Entry<Integer, List<SedimentDensityValue>> entry = |
127 densities.firstEntry(); | |
124 return entry.getKey() <= year | 128 return entry.getKey() <= year |
125 ? getDensityAtKm(entry.getValue(), km) | 129 ? getDensityAtKm(entry.getValue(), km) |
126 : SEDIMNET_DENSITY_FACTOR; | 130 : SEDIMNET_DENSITY_FACTOR; |
127 } | 131 } |
128 | 132 |
130 densities.entrySet().iterator(); | 134 densities.entrySet().iterator(); |
131 | 135 |
132 Map.Entry<Integer, List<SedimentDensityValue>> last = iter.next(); | 136 Map.Entry<Integer, List<SedimentDensityValue>> last = iter.next(); |
133 | 137 |
134 while (iter.hasNext()) { | 138 while (iter.hasNext()) { |
135 Map.Entry<Integer, List<SedimentDensityValue>> current = iter.next(); | 139 Map.Entry<Integer, List<SedimentDensityValue>> current = |
140 iter.next(); | |
136 last = current; | 141 last = current; |
137 int y1 = last.getKey(); | 142 int y1 = last.getKey(); |
138 int y2 = current.getKey(); | 143 int y2 = current.getKey(); |
139 if (year >= y1 && year < y2) { | 144 if (year >= y1 && year < y2) { |
140 return getDensityAtKm(last.getValue(), km); | 145 return getDensityAtKm(last.getValue(), km); |