comparison gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SalixZone.java @ 9238:1c756bfee472

salix.supraregional table revision -> Anschluss
author gernotbelger
date Tue, 10 Jul 2018 13:27:17 +0200
parents 972e10522ed6
children cbe393451ab0
comparison
equal deleted inserted replaced
9237:972e10522ed6 9238:1c756bfee472
150 public int compareTo(final SalixZone o) { 150 public int compareTo(final SalixZone o) {
151 final int basicCompare = this.getLowerFromTo().compareTo(o.getLowerFromTo()); 151 final int basicCompare = this.getLowerFromTo().compareTo(o.getLowerFromTo());
152 return basicCompare; 152 return basicCompare;
153 } 153 }
154 154
155 public static boolean isValidAnschlussRange(final double fromTest, final double toTest, final List<SalixZone> list, final double minKm) {
156 final SalixZone zone = new SalixZone(0, fromTest, toTest);
157 final double lower = zone.getLowerFromTo();
158 final double anschluss = getAnschluss(list, minKm);
159 final double differenceAbs = (lower - anschluss) > 0 ? (lower - anschluss) : (anschluss - lower); // no Math.abs allowed :-(
160 if (differenceAbs > DELTA) {
161 return false;
162 }
163
164 return true;
165 }
166
167 private static double getAnschluss(final List<SalixZone> list, final double minKm) {
168
169 if (list.size() > 0) {
170 return list.get(list.size() - 1).getUpperFromTo();
171 }
172 return minKm;
173 }
174
155 } 175 }

http://dive4elements.wald.intevation.org