comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java @ 8662:c9b8ad659d5b

Use EpsilonComparator instead of redundant implementation.
author "Tom Gottfried <tom@intevation.de>"
date Tue, 07 Apr 2015 11:20:36 +0200
parents a9ff696c2d18
children b78ca00d4659
comparison
equal deleted inserted replaced
8661:befa08182368 8662:c9b8ad659d5b
28 import org.apache.commons.math.ArgumentOutsideDomainException; 28 import org.apache.commons.math.ArgumentOutsideDomainException;
29 29
30 import org.apache.commons.math.exception.MathIllegalArgumentException; 30 import org.apache.commons.math.exception.MathIllegalArgumentException;
31 31
32 import gnu.trove.TDoubleArrayList; 32 import gnu.trove.TDoubleArrayList;
33
34 import static org.dive4elements.river.backend.utils.EpsilonComparator.CMP;
33 35
34 /** 36 /**
35 * W, Q and km data from database 'wsts' spiced with interpolation algorithms. 37 * W, Q and km data from database 'wsts' spiced with interpolation algorithms.
36 */ 38 */
37 public class WstValueTable 39 public class WstValueTable
199 201
200 /** 202 /**
201 * Compare according to place of measurement (km). 203 * Compare according to place of measurement (km).
202 */ 204 */
203 public int compareTo(Row other) { 205 public int compareTo(Row other) {
204 double d = km - other.km; 206 return CMP.compare(km, other.km);
205 if (d < -0.0001) return -1;
206 if (d > 0.0001) return +1;
207 return 0;
208 } 207 }
209 208
210 /** 209 /**
211 * Interpolate Ws, given Qs and a km. 210 * Interpolate Ws, given Qs and a km.
212 * 211 *

http://dive4elements.wald.intevation.org