Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/math/HeightValue.java @ 875:5e9efdda6894
merged gnv-artifacts/1.0
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:13:56 +0200 |
parents | a645bd23c1c8 |
children | f953c9a559d8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/HeightValue.java Fri Sep 28 12:13:56 2012 +0200 @@ -0,0 +1,83 @@ +package de.intevation.gnv.math; + +import java.io.Serializable; + +import java.util.Comparator; + +/** + * An attributed height value. It holds a z value, a parameter value + * and a layer index. + * + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> + */ +public class HeightValue +implements Serializable +{ + /** + * Comparator to sort <code>HeightValue</code>s by their z value + * in reversed order. + */ + public static final Comparator INV_Z_COMPARATOR = new Comparator() { + public int compare(Object a, Object b) { + HeightValue ha = (HeightValue)a; + HeightValue hb = (HeightValue)b; + if (ha.z > hb.z) return -1; + if (ha.z < hb.z) return +1; + return 0; + } + }; + + /** + * The height value. + */ + public double z; + + /** + * The parameter value. + */ + public double v; + + /** + * The layer index; + */ + public int k; + + /** + * Constructor to create a HeightValue with a given height, + * parameter value and layer index. + * @param z The height. + * @param v The parameter value. + * @param k The layer index. + */ + public HeightValue(double z, double v, int k) { + this.z = z; + this.v = v; + this.k = k; + } + + /** + * Return the height of this HeightValue. + * @return the height. + */ + public double getZ() { + return z; + } + + /** + * Return the parameter value of this HeightValue. + * @return The parameter value. + */ + public double getV() { + return v; + } + + /** + * Returns the layer index of this HeightValue. + * @return The layer index. + */ + public double getK() { + return k; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :