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 |
|
43 public static final UInfoResultType salixline = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.salix_line") { |
9006
|
44 private static final long serialVersionUID = 1L; |
|
45 |
8996
|
46 @Override |
|
47 public String exportValue(final CallContext context, final Object value) { |
|
48 final double doubleValue = asDouble(value); |
|
49 return exportDoubleValue(context, doubleValue); |
|
50 } |
|
51 |
|
52 @Override |
|
53 protected NumberFormat createFormatter(final CallContext context) { |
|
54 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of |
|
55 // digits. |
|
56 return Formatter.getSalixLine(context); |
|
57 } |
|
58 }; |
|
59 |
|
60 public static final UInfoResultType salixlinehist = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.hist") { |
9006
|
61 private static final long serialVersionUID = 1L; |
|
62 |
8996
|
63 @Override |
|
64 public String exportValue(final CallContext context, final Object value) { |
|
65 final double doubleValue = asDouble(value); |
|
66 return exportDoubleValue(context, doubleValue); |
|
67 } |
|
68 |
|
69 @Override |
|
70 protected NumberFormat createFormatter(final CallContext context) { |
|
71 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of |
|
72 // digits. |
|
73 return Formatter.getSalixLine(context); |
|
74 } |
|
75 }; |
|
76 |
|
77 public static final UInfoResultType salixlinescen = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scen") { |
9006
|
78 private static final long serialVersionUID = 1L; |
|
79 |
8996
|
80 @Override |
|
81 public String exportValue(final CallContext context, final Object value) { |
|
82 final double doubleValue = asDouble(value); |
|
83 return exportDoubleValue(context, doubleValue); |
|
84 } |
|
85 |
|
86 @Override |
|
87 protected NumberFormat createFormatter(final CallContext context) { |
|
88 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of |
|
89 // digits. |
|
90 return Formatter.getSalixLine(context); |
|
91 } |
|
92 }; |
|
93 |
9006
|
94 public static final UInfoResultType vegname = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.name") { |
|
95 private static final long serialVersionUID = 1L; |
|
96 |
|
97 @Override |
|
98 public String exportValue(final CallContext context, final Object value) { |
|
99 return exportStringValue(value); |
|
100 } |
|
101 |
|
102 @Override |
|
103 protected NumberFormat createFormatter(final CallContext context) { |
|
104 throw new UnsupportedOperationException(); |
|
105 } |
|
106 }; |
|
107 |
|
108 public static final UInfoResultType vegdauervon = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauervon") { |
|
109 private static final long serialVersionUID = 1L; |
|
110 |
|
111 @Override |
|
112 public String exportValue(final CallContext context, final Object value) { |
9101
|
113 final double doubleValue = asDouble(value); |
|
114 return exportDoubleValue(context, doubleValue); |
9006
|
115 } |
|
116 |
|
117 @Override |
|
118 protected NumberFormat createFormatter(final CallContext context) { |
|
119 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of |
|
120 // digits. |
|
121 return Formatter.getUeberflutungsdauer(context); |
|
122 } |
|
123 }; |
|
124 |
|
125 public static final UInfoResultType vegdauerbis = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauerbis") { |
|
126 private static final long serialVersionUID = 1L; |
|
127 |
|
128 @Override |
|
129 public String exportValue(final CallContext context, final Object value) { |
9101
|
130 |
|
131 final double doubleValue = asDouble(value); |
|
132 return exportDoubleValue(context, doubleValue); |
9006
|
133 } |
|
134 |
|
135 @Override |
|
136 protected NumberFormat createFormatter(final CallContext context) { |
|
137 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of |
|
138 // digits. |
|
139 return Formatter.getUeberflutungsdauer(context); |
|
140 } |
|
141 }; |
8996
|
142 } |