view gnv-artifacts/src/main/java/de/intevation/gnv/math/HeightValue.java @ 1055:bb2679624c6a

Implemented a new histogram dataset that takes the width of a single bin as well as the number of bins for the histogram (issue288). gnv-artifacts/trunk@1130 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 27 May 2010 07:41:14 +0000
parents a645bd23c1c8
children f953c9a559d8
line wrap: on
line source
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 :

http://dive4elements.wald.intevation.org