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) { |
|
79 final String valueStr = String.valueOf(value); |
|
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 |
|
154 public static final UInfoResultType vegdauervon = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauervon") { |
|
155 private static final long serialVersionUID = 1L; |
|
156 |
|
157 @Override |
|
158 public String exportValue(final CallContext context, final Object value) { |
9101
|
159 final double doubleValue = asDouble(value); |
|
160 return exportDoubleValue(context, doubleValue); |
9006
|
161 } |
|
162 |
|
163 @Override |
|
164 protected NumberFormat createFormatter(final CallContext context) { |
|
165 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of |
|
166 // digits. |
|
167 return Formatter.getUeberflutungsdauer(context); |
|
168 } |
|
169 }; |
|
170 |
|
171 public static final UInfoResultType vegdauerbis = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauerbis") { |
|
172 private static final long serialVersionUID = 1L; |
|
173 |
|
174 @Override |
|
175 public String exportValue(final CallContext context, final Object value) { |
9101
|
176 |
|
177 final double doubleValue = asDouble(value); |
|
178 return exportDoubleValue(context, doubleValue); |
9006
|
179 } |
|
180 |
|
181 @Override |
|
182 protected NumberFormat createFormatter(final CallContext context) { |
|
183 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of |
|
184 // digits. |
|
185 return Formatter.getUeberflutungsdauer(context); |
|
186 } |
|
187 }; |
8996
|
188 } |