ingo@427: package de.intevation.gnv.math;
ingo@427:
ingo@429: import java.io.Serializable;
ingo@429:
sascha@433: import java.util.Comparator;
sascha@433:
ingo@427: /**
sascha@807: * An attributed height value. It holds a z value, a parameter value
sascha@807: * and a layer index.
sascha@807: *
sascha@780: * @author Ingo Weinzierl
sascha@780: * @author Sascha L. Teichmann
ingo@427: */
ingo@429: public class HeightValue
ingo@429: implements Serializable
ingo@429: {
sascha@807: /**
sascha@807: * Comparator to sort HeightValue
s by their z value
sascha@807: * in reversed order.
sascha@807: */
sascha@433: public static final Comparator INV_Z_COMPARATOR = new Comparator() {
sascha@433: public int compare(Object a, Object b) {
sascha@433: HeightValue ha = (HeightValue)a;
sascha@433: HeightValue hb = (HeightValue)b;
sascha@433: if (ha.z > hb.z) return -1;
sascha@433: if (ha.z < hb.z) return +1;
sascha@433: return 0;
sascha@433: }
sascha@433: };
ingo@427:
sascha@807: /**
sascha@807: * The height value.
sascha@807: */
sascha@433: public double z;
sascha@807:
sascha@807: /**
sascha@807: * The parameter value.
sascha@807: */
sascha@433: public double v;
sascha@807:
sascha@807: /**
sascha@807: * The layer index;
sascha@807: */
sascha@433: public int k;
ingo@427:
sascha@807: /**
sascha@807: * Constructor to create a HeightValue with a given height,
sascha@807: * parameter value and layer index.
sascha@807: * @param z The height.
sascha@807: * @param v The parameter value.
sascha@807: * @param k The layer index.
sascha@807: */
ingo@427: public HeightValue(double z, double v, int k) {
ingo@427: this.z = z;
ingo@427: this.v = v;
ingo@427: this.k = k;
ingo@427: }
ingo@427:
sascha@807: /**
sascha@807: * Return the height of this HeightValue.
sascha@807: * @return the height.
sascha@807: */
ingo@427: public double getZ() {
ingo@427: return z;
ingo@427: }
ingo@427:
sascha@807: /**
sascha@807: * Return the parameter value of this HeightValue.
sascha@807: * @return The parameter value.
sascha@807: */
ingo@427: public double getV() {
ingo@427: return v;
ingo@427: }
ingo@427:
sascha@807: /**
sascha@807: * Returns the layer index of this HeightValue.
sascha@807: * @return The layer index.
sascha@807: */
ingo@427: public double getK() {
ingo@427: return k;
ingo@427: }
ingo@427: }
sascha@798: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :