Mercurial > dive4elements > gnv-client
comparison 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 |
comparison
equal
deleted
inserted
replaced
722:bb3ffe7d719e | 875:5e9efdda6894 |
---|---|
1 package de.intevation.gnv.math; | |
2 | |
3 import java.io.Serializable; | |
4 | |
5 import java.util.Comparator; | |
6 | |
7 /** | |
8 * An attributed height value. It holds a z value, a parameter value | |
9 * and a layer index. | |
10 * | |
11 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
12 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> | |
13 */ | |
14 public class HeightValue | |
15 implements Serializable | |
16 { | |
17 /** | |
18 * Comparator to sort <code>HeightValue</code>s by their z value | |
19 * in reversed order. | |
20 */ | |
21 public static final Comparator INV_Z_COMPARATOR = new Comparator() { | |
22 public int compare(Object a, Object b) { | |
23 HeightValue ha = (HeightValue)a; | |
24 HeightValue hb = (HeightValue)b; | |
25 if (ha.z > hb.z) return -1; | |
26 if (ha.z < hb.z) return +1; | |
27 return 0; | |
28 } | |
29 }; | |
30 | |
31 /** | |
32 * The height value. | |
33 */ | |
34 public double z; | |
35 | |
36 /** | |
37 * The parameter value. | |
38 */ | |
39 public double v; | |
40 | |
41 /** | |
42 * The layer index; | |
43 */ | |
44 public int k; | |
45 | |
46 /** | |
47 * Constructor to create a HeightValue with a given height, | |
48 * parameter value and layer index. | |
49 * @param z The height. | |
50 * @param v The parameter value. | |
51 * @param k The layer index. | |
52 */ | |
53 public HeightValue(double z, double v, int k) { | |
54 this.z = z; | |
55 this.v = v; | |
56 this.k = k; | |
57 } | |
58 | |
59 /** | |
60 * Return the height of this HeightValue. | |
61 * @return the height. | |
62 */ | |
63 public double getZ() { | |
64 return z; | |
65 } | |
66 | |
67 /** | |
68 * Return the parameter value of this HeightValue. | |
69 * @return The parameter value. | |
70 */ | |
71 public double getV() { | |
72 return v; | |
73 } | |
74 | |
75 /** | |
76 * Returns the layer index of this HeightValue. | |
77 * @return The layer index. | |
78 */ | |
79 public double getK() { | |
80 return k; | |
81 } | |
82 } | |
83 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |