Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/WstWriter.java @ 2558:33e4481933e2
WstValueTable: Added method to find the w extent for a given km range.
flys-artifacts/trunk@4080 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 17 Feb 2012 11:59:30 +0000 |
parents | 72bcbc308501 |
children | d9fb3a178be4 |
rev | line source |
---|---|
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.exports; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.BufferedWriter; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.io.OutputStream; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.io.OutputStreamWriter; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.io.PrintWriter; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
8 import java.util.ArrayList; |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import java.util.Collection; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import java.util.HashMap; |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
11 import java.util.List; |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import java.util.Locale; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import java.util.Map; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import java.util.TreeMap; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.apache.log4j.Logger; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.artifacts.model.WstLine; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * A writer that creates WSTs. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 * |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 */ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 public class WstWriter { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 /** The logger used in this class.*/ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 private static Logger logger = Logger.getLogger(WstWriter.class); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 /** The default unit that is written into the header of the WST.*/ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public static final String DEFAULT_UNIT = "Wassserstand [NN + m]"; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 /** The lines that need to be included for the export.*/ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 protected Map<Double, WstLine> lines; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
39 /** The column names.*/ |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
40 protected List<String> columnNames; |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
41 |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 /** The locale used to format the values.*/ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 protected Locale locale; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 /** The number of discharge columns.*/ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 protected int cols; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 /** The last Q values.*/ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 protected double[] qs; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 /** |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 * This constructor creates a new WstWriter with an OutputStream and a |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 * number of Q columns. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 * |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 * @param out The output stream where the WST is written to. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 * @param cols The number of columns of the resulting WST. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 */ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 public WstWriter(int cols) { |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
61 this.columnNames = new ArrayList<String>(cols); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
62 this.lines = new HashMap<Double, WstLine>(); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
63 this.qs = new double[cols]; |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
64 this.locale = Locale.US; |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 /** |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 * This method is used to create the WST from the data that has been |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 * inserted using add(double[]) before. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 */ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 public void write(OutputStream out) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 logger.info("WstWriter.write"); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 PrintWriter writer = new PrintWriter( |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 new BufferedWriter( |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 new OutputStreamWriter(out))); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
749
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
79 this.qs = new double[cols]; |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
80 |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 writeHeader(writer); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 Collection<WstLine> collection = new TreeMap(lines).values(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 for (WstLine line: collection) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 writeWLine(writer, line); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 writer.flush(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 writer.close(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 /** |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 * This method is used to add a new line to the WST. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 * |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 * @param wqkms A 3dim double array with [W,Q, KM]. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 */ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 public void add(double[] wqkms) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 Double km = wqkms[2]; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 WstLine line = lines.get(km); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 if (line == null) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 line = new WstLine(km.doubleValue()); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 lines.put(km, line); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 line.add(wqkms[0], wqkms[1]); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
749
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
113 public void addCorrected(double[] wqckms) { |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
114 Double km = wqckms[2]; |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
115 |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
116 WstLine line = lines.get(km); |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
117 |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
118 if (line == null) { |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
119 line = new WstLine(km.doubleValue()); |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
120 lines.put(km, line); |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
121 } |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
122 |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
123 line.add(wqckms[3], wqckms[1]); |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
124 } |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
125 |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
126 |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 /** |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
128 * Adds a further column name. |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
129 * |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
130 * @param name The name of the new column. |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
131 */ |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
132 public void addColumn(String name) { |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
133 if (name != null) { |
749
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
134 cols++; |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
135 |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
136 String basename = name; |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
137 |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
138 int i = 0; |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
139 while (columnNames.contains(name)) { |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
140 name = basename + "_" + i++; |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
141 |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
142 if (name.length() > 9) { |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
143 name = name.substring(name.length() - 9); |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
144 } |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
145 } |
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
146 |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
147 columnNames.add(name); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
148 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
149 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
150 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
151 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
152 /** |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 * This method writes the header of the WST. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 * |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 * @param writer The PrintWriter that creates the output. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 */ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 protected void writeHeader(PrintWriter writer) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 logger.debug("WstWriter.writeHeader"); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 writer.println(cols); |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
161 writer.print(" "); |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 |
447
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
163 for (String columnName: columnNames) { |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
164 writer.printf(locale, "%9s", columnName); |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
165 } |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
166 |
5606ba4139e0
WSTs will now have a header that contains the names of the Ws or Qs that had been defined for the computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
446
diff
changeset
|
167 writer.println(); |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 writer.write("* KM "); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 writer.write(DEFAULT_UNIT); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 writer.println(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 /** |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 * This method writes a line with W values and a certain kilometer. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 * |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 * @param writer The PrintWriter that is used to create the output. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 * @param line The WstLine that should be written to the output. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 */ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 protected void writeWLine(PrintWriter writer, WstLine line) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 double km = line.getKm(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 double[] qs = line.getQs(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 int num = line.getSize(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 if (dischargesChanged(qs)) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 writeQLine(writer, qs); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 writer.printf(locale, "%8.3f", km); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 for (int i = 0; i < num; i++) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 writer.printf(locale, "%9.2f", line.getW(i)); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 writer.println(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 /** |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 * Writes a discharge line (Q values) into a WST. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
202 * |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 * @param qs the Q values for the next range. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 */ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 protected void writeQLine(PrintWriter writer, double[] qs) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 writer.write("*\u001f "); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 |
749
72bcbc308501
The WST export contains the corrected W values now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
447
diff
changeset
|
208 for (int i = 0; i < qs.length; i++) { |
446
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
209 this.qs[i] = qs[i]; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
210 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 writer.printf(locale, "%9.2f", qs[i]); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 writer.println(); |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 /** |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
219 * This method determines if a Q has changed from the last line to the |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
220 * current one. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
221 * |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 * @param newQs The Q values of the next line. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 * |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 * @return true, if a Q value have changed, otherwise false. |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
225 */ |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
226 protected boolean dischargesChanged(double[] newQs) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
227 // XXX maybe there is a way to do this faster |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 for (int i = 0; i < cols; i++) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 if (Math.abs(newQs[i] - qs[i]) >= 0.001) { |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 return true; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 return false; |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 } |
c0bec245f608
Implemented writer that creates WSTs and enabled the WaterlevelExporter to create those.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |