comparison flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveExporter.java @ 445:a7947972fdeb

Added a new class that supports formatters for different types of data. flys-artifacts/trunk@1937 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 17 May 2011 14:22:27 +0000
parents e0fec407a280
children e006da5679d2
comparison
equal deleted inserted replaced
444:932a5e3c7fa1 445:a7947972fdeb
14 import de.intevation.artifacts.Artifact; 14 import de.intevation.artifacts.Artifact;
15 import de.intevation.artifacts.CallContext; 15 import de.intevation.artifacts.CallContext;
16 16
17 import de.intevation.flys.artifacts.WINFOArtifact; 17 import de.intevation.flys.artifacts.WINFOArtifact;
18 import de.intevation.flys.artifacts.model.WQDay; 18 import de.intevation.flys.artifacts.model.WQDay;
19 import de.intevation.flys.utils.Formatter;
19 20
20 21
21 /** 22 /**
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 23 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
23 */ 24 */
24 public class DurationCurveExporter extends AbstractExporter { 25 public class DurationCurveExporter extends AbstractExporter {
25 26
26 /** The logger used in this exporter.*/ 27 /** The logger used in this exporter.*/
27 private static Logger logger = Logger.getLogger(WaterlevelExporter.class); 28 private static Logger logger = Logger.getLogger(WaterlevelExporter.class);
28 29
29
30 public static final int W_MIN_DIGITS = 0;
31 public static final int W_MAX_DIGITS = 2;
32 public static final int Q_MIN_DIGITS = 0;
33 public static final int Q_MAX_DIGITS = 1;
34 public static final int D_MIN_DIGITS = 0;
35 public static final int D_MAX_DIGITS = 0;
36 30
37 public static final String CSV_DURATION_HEADER = 31 public static final String CSV_DURATION_HEADER =
38 "export.duration.curve.csv.header.duration"; 32 "export.duration.curve.csv.header.duration";
39 33
40 public static final String CSV_W_HEADER = 34 public static final String CSV_W_HEADER =
112 * Returns the number formatter for W values. 106 * Returns the number formatter for W values.
113 * 107 *
114 * @return the number formatter for W values. 108 * @return the number formatter for W values.
115 */ 109 */
116 protected NumberFormat getWFormatter() { 110 protected NumberFormat getWFormatter() {
117 return getFormatter(W_MIN_DIGITS, W_MAX_DIGITS); 111 return Formatter.getDurationW(context);
118 } 112 }
119 113
120 114
121 /** 115 /**
122 * Returns the number formatter for Q values. 116 * Returns the number formatter for Q values.
123 * 117 *
124 * @return the number formatter for Q values. 118 * @return the number formatter for Q values.
125 */ 119 */
126 protected NumberFormat getQFormatter() { 120 protected NumberFormat getQFormatter() {
127 return getFormatter(Q_MIN_DIGITS, Q_MAX_DIGITS); 121 return Formatter.getDurationQ(context);
128 } 122 }
129 123
130 124
131 /** 125 /**
132 * Returns the number formatter for duration values. 126 * Returns the number formatter for duration values.
133 * 127 *
134 * @return the number formatter for duration values. 128 * @return the number formatter for duration values.
135 */ 129 */
136 protected NumberFormat getDFormatter() { 130 protected NumberFormat getDFormatter() {
137 return getFormatter(D_MIN_DIGITS, D_MAX_DIGITS); 131 return Formatter.getDurationD(context);
138 } 132 }
139 } 133 }

http://dive4elements.wald.intevation.org