Mercurial > dive4elements > river
view flys-aft/src/main/java/de/intevation/aft/WQ.java @ 4287:82c1e911dd71
Add start and end time of an observation on a measurement station
Add start and end time of an observation on a measurement station to the
MeasurementStation classes.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 29 Oct 2012 09:54:31 +0100 |
parents | 82f5266f881b |
children |
line wrap: on
line source
package de.intevation.aft; import java.util.Comparator; public class WQ { public static final double EPSILON = 1e-4; public static final Comparator<WQ> EPS_CMP = new Comparator<WQ>() { @Override public int compare(WQ a, WQ b) { int cmp = compareEpsilon(a.q, b.q); if (cmp != 0) return cmp; return compareEpsilon(a.w, b.w); } }; protected int id; protected double w; protected double q; public WQ() { } public WQ(double w, double q) { this.w = w; this.q = q; } public WQ(int id, double w, double q) { this.id = id; this.w = w; this.q = q; } public static final int compareEpsilon(double a, double b) { double diff = a - b; if (diff < -EPSILON) return -1; return diff > EPSILON ? +1 : 0; } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getW() { return w; } public void setW(double w) { this.w = w; } public double getQ() { return q; } public void setQ(double q) { this.q = q; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :