comparison artifacts/src/main/java/org/dive4elements/river/exports/WstWriter.java @ 7656:ad5238e3e736

Cosmetics of WstWriter. Actually, a decent class now.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 05 Dec 2013 22:04:15 +0100
parents 197bd0958cba
children 4fb5e89e7bd3
comparison
equal deleted inserted replaced
7655:81ae2a4873f2 7656:ad5238e3e736
28 28
29 29
30 /** 30 /**
31 * A writer that creates WSTs. 31 * A writer that creates WSTs.
32 * 32 *
33 * Wst files follow this basic structure:
34 *
35 * HEADER
36 * Q-LINE
37 * W-LINES
38 * Q-LINE
39 * W-LINES
40 * ...
41 *
42 * where each *LINE consists of X columns that are specified in the header.
43 *
33 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 44 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
34 */ 45 */
35 public class WstWriter { 46 public class WstWriter {
36 47
37 /** The logger used in this class. */ 48 /** The logger used in this class. */
54 65
55 /** The last Q values. */ 66 /** The last Q values. */
56 protected double[] qs; 67 protected double[] qs;
57 68
58 69
59
60 /** 70 /**
61 * This constructor creates a new WstWriter with a number of Q columns. 71 * This constructor creates a new WstWriter with a number of Q columns.
62 * 72 *
63 * @param cols The number of columns of the resulting WST. 73 * @param columns The number of columns of the resulting WST.
64 */ 74 */
65 public WstWriter(int cols) { 75 public WstWriter(int columns) {
76 this.cols = columns;
66 this.columnNames = new ArrayList<String>(cols); 77 this.columnNames = new ArrayList<String>(cols);
67 this.lines = new HashMap<Double, WstLine>(); 78 this.lines = new HashMap<Double, WstLine>();
68 this.qs = new double[cols]; 79 this.qs = new double[cols];
69 this.locale = Locale.US; 80 this.locale = Locale.US;
70 } 81 }
98 109
99 110
100 /** 111 /**
101 * This method is used to add a new line to the WST. 112 * This method is used to add a new line to the WST.
102 * 113 *
103 * @param wqkms A 3dim double array with [W,Q, KM]. 114 * @param wqkms A 3dim double array with [W, Q, KM].
104 */ 115 */
105 public void add(double[] wqkms) { 116 public void add(double[] wqkms) {
106 Double km = wqkms[2]; 117 Double km = wqkms[2];
107 118
108 WstLine line = lines.get(km); 119 WstLine line = lines.get(km);
257 return false; 268 return false;
258 } 269 }
259 270
260 /** 271 /**
261 * Get the lines that have alreay been added to this writer 272 * Get the lines that have alreay been added to this writer
262 * lines are a map with km as the key and a wstline as value */ 273 * lines are a map with km as the key and a wstline as value.
274 */
263 public Map<Double, WstLine> getLines() { 275 public Map<Double, WstLine> getLines() {
264 return lines; 276 return lines;
265 } 277 }
266 } 278 }
267 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 279 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org