comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/W.java @ 8362:839032ac1523

Purge obsolete representation of reference system for discharge tables.
author Tom Gottfried <tom@intevation.de>
date Wed, 01 Oct 2014 15:54:47 +0200
parents d24d95b0e1f9
children 0a5239a1e46e
comparison
equal deleted inserted replaced
8361:c494f9a61490 8362:839032ac1523
20 { 20 {
21 private static Logger log = Logger.getLogger(W.class); 21 private static Logger log = Logger.getLogger(W.class);
22 22
23 protected TDoubleArrayList ws; 23 protected TDoubleArrayList ws;
24 24
25 public static final int METER_OVER_REFPOINT = 0;
26
27 public static final int CENTIMETER_AT_GAUGE = 1;
28
29 protected int referenceSystem;
30
31 public W() { 25 public W() {
32 ws = new TDoubleArrayList(); 26 ws = new TDoubleArrayList();
33 } 27 }
34 28
35 public W(String name) { 29 public W(String name) {
40 public W(int capacity) { 34 public W(int capacity) {
41 this(capacity, ""); 35 this(capacity, "");
42 } 36 }
43 37
44 public W(int capacity, String name) { 38 public W(int capacity, String name) {
45 this(capacity, "", METER_OVER_REFPOINT);
46 }
47
48 public W(int capacity, String name, int referenceSystem) {
49 super(name); 39 super(name);
50 this.referenceSystem = referenceSystem;
51 ws = new TDoubleArrayList(capacity); 40 ws = new TDoubleArrayList(capacity);
52 }
53
54 /** Sets the used reference system for W.
55 * If the W's refer to values in meters over a reference
56 * point (e.g. NN+m) they are in meter. If they are
57 * relative to the PNP of a gauge they are in centimeter. */
58 public void setReferenceSystem(int val) {
59 referenceSystem = val;
60 }
61
62 /** Return the used reference system for W.
63 * If the W's refer to values in meters over a reference
64 * point (e.g. NN+m) they are in meter. If they are
65 * relative to the PNP of a gauge they are in centimeter. */
66 public int getReferenceSystem() {
67 return referenceSystem;
68 }
69
70 /** Convenience function to get the correct unit for W values. */
71 public String getWUnit() {
72 if (getReferenceSystem() == CENTIMETER_AT_GAUGE) {
73 return "cm";
74 }
75 return "m";
76 } 41 }
77 42
78 public void add(double value) { 43 public void add(double value) {
79 ws.add(value); 44 ws.add(value);
80 } 45 }

http://dive4elements.wald.intevation.org