Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java @ 9316:72b3270e1568
U-Info salix line with regional and supraregional scenario calculation and chart display
author | mschaefer |
---|---|
date | Thu, 26 Jul 2018 17:28:32 +0200 |
parents | b570b6fcc052 |
children |
rev | line source |
---|---|
8996 | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.uinfo.commons; | |
11 | |
12 import java.text.NumberFormat; | |
13 | |
14 import org.dive4elements.artifacts.CallContext; | |
15 import org.dive4elements.river.artifacts.common.AbstractResultType; | |
16 import org.dive4elements.river.utils.Formatter; | |
17 | |
18 /** | |
19 * @author Domenico Nardi Tironi | |
20 * | |
21 */ | |
22 public abstract class UInfoResultType extends AbstractResultType { | |
23 | |
9006 | 24 private static final long serialVersionUID = 1L; |
25 | |
8996 | 26 public UInfoResultType(final String unit, final String csvHeader) { |
27 super(unit, csvHeader, csvHeader); | |
28 | |
29 } | |
30 | |
31 @Override | |
32 public String exportValue(final CallContext context, final Object value) { | |
33 // TODO Auto-generated method stub | |
34 return null; | |
35 } | |
36 | |
37 @Override | |
38 protected NumberFormat createFormatter(final CallContext context) { | |
39 // TODO Auto-generated method stub | |
40 return null; | |
41 } | |
42 | |
9243 | 43 public static final UInfoResultType customMultiRowColSalixRegionalValue_Dwspl = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scenario") { |
44 private static final long serialVersionUID = 1L; | |
45 | |
46 @Override | |
47 public String exportValue(final CallContext context, final Object value) { | |
48 throw new UnsupportedOperationException(); | |
49 } | |
50 | |
51 @Override | |
52 protected NumberFormat createFormatter(final CallContext context) { | |
53 throw new UnsupportedOperationException(); | |
54 } | |
55 }; | |
56 | |
57 public static final UInfoResultType salix_line_scenario = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scenario") { | |
58 private static final long serialVersionUID = 1L; | |
59 | |
60 @Override | |
61 public String exportValue(final CallContext context, final Object value) { | |
62 final double doubleValue = asDouble(value); | |
63 return exportDoubleValue(context, doubleValue); | |
64 } | |
65 | |
66 @Override | |
67 protected NumberFormat createFormatter(final CallContext context) { | |
68 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
69 // digits. | |
70 return Formatter.getSalixLine(context); | |
71 } | |
72 }; | |
73 | |
74 public static final UInfoResultType salix_line_scenario_dwspl = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scenario_dwspl") { | |
75 private static final long serialVersionUID = 1L; | |
76 | |
77 @Override | |
78 public String exportValue(final CallContext context, final Object value) { | |
9316
72b3270e1568
U-Info salix line with regional and supraregional scenario calculation and chart display
mschaefer
parents:
9260
diff
changeset
|
79 final String valueStr = ((int) value == 0) ? "" : String.valueOf(value); |
9243 | 80 return exportStringValue(valueStr); |
81 } | |
82 | |
83 @Override | |
84 protected NumberFormat createFormatter(final CallContext context) { | |
85 | |
86 return Formatter.getIntegerFormatter(context); | |
87 } | |
88 }; | |
89 public static final UInfoResultType salix_delta_mw = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.delta_mw") { | |
90 private static final long serialVersionUID = 1L; | |
91 | |
92 @Override | |
93 public String exportValue(final CallContext context, final Object value) { | |
94 final double doubleValue = asDouble(value); | |
95 return exportDoubleValue(context, doubleValue); | |
96 } | |
97 | |
98 @Override | |
99 protected NumberFormat createFormatter(final CallContext context) { | |
100 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
101 // digits. | |
102 return Formatter.getSalixLine(context); | |
103 } | |
104 }; | |
105 | |
8996 | 106 public static final UInfoResultType salixline = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.salix_line") { |
9006 | 107 private static final long serialVersionUID = 1L; |
108 | |
8996 | 109 @Override |
110 public String exportValue(final CallContext context, final Object value) { | |
111 final double doubleValue = asDouble(value); | |
112 return exportDoubleValue(context, doubleValue); | |
113 } | |
114 | |
115 @Override | |
116 protected NumberFormat createFormatter(final CallContext context) { | |
117 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
118 // digits. | |
119 return Formatter.getSalixLine(context); | |
120 } | |
121 }; | |
122 | |
123 public static final UInfoResultType salixlinehist = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.hist") { | |
9006 | 124 private static final long serialVersionUID = 1L; |
125 | |
8996 | 126 @Override |
127 public String exportValue(final CallContext context, final Object value) { | |
128 final double doubleValue = asDouble(value); | |
129 return exportDoubleValue(context, doubleValue); | |
130 } | |
131 | |
132 @Override | |
133 protected NumberFormat createFormatter(final CallContext context) { | |
134 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
135 // digits. | |
136 return Formatter.getSalixLine(context); | |
137 } | |
138 }; | |
139 | |
9006 | 140 public static final UInfoResultType vegname = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.name") { |
141 private static final long serialVersionUID = 1L; | |
142 | |
143 @Override | |
144 public String exportValue(final CallContext context, final Object value) { | |
145 return exportStringValue(value); | |
146 } | |
147 | |
148 @Override | |
149 protected NumberFormat createFormatter(final CallContext context) { | |
150 throw new UnsupportedOperationException(); | |
151 } | |
152 }; | |
153 | |
9260 | 154 public static final UInfoResultType vegzone_color = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.color") { |
155 private static final long serialVersionUID = 1L; | |
156 | |
157 @Override | |
158 public String exportValue(final CallContext context, final Object value) { | |
159 return exportStringValue(value); | |
160 } | |
161 | |
162 @Override | |
163 protected NumberFormat createFormatter(final CallContext context) { | |
164 throw new UnsupportedOperationException(); | |
165 } | |
166 }; | |
9006 | 167 public static final UInfoResultType vegdauervon = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauervon") { |
168 private static final long serialVersionUID = 1L; | |
169 | |
170 @Override | |
171 public String exportValue(final CallContext context, final Object value) { | |
9101 | 172 final double doubleValue = asDouble(value); |
173 return exportDoubleValue(context, doubleValue); | |
9006 | 174 } |
175 | |
176 @Override | |
177 protected NumberFormat createFormatter(final CallContext context) { | |
178 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
179 // digits. | |
180 return Formatter.getUeberflutungsdauer(context); | |
181 } | |
182 }; | |
183 | |
184 public static final UInfoResultType vegdauerbis = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauerbis") { | |
185 private static final long serialVersionUID = 1L; | |
186 | |
187 @Override | |
188 public String exportValue(final CallContext context, final Object value) { | |
9260 | 189 // valix hex-Check? |
190 return String.valueOf(value); | |
9006 | 191 } |
192 | |
193 @Override | |
194 protected NumberFormat createFormatter(final CallContext context) { | |
195 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
196 // digits. | |
197 return Formatter.getUeberflutungsdauer(context); | |
198 } | |
199 }; | |
8996 | 200 } |