Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java @ 9069:1ffd38826175
access uinfo.vegetationzones+inundation_duration
author | gernotbelger |
---|---|
date | Tue, 15 May 2018 12:00:26 +0200 |
parents | 7134a4c7d1b6 |
children | 2c6aba003112 |
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 | |
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) { | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9006
diff
changeset
|
113 return exportStringValue(value); |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9006
diff
changeset
|
114 // final double doubleValue = asDouble(value); |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9006
diff
changeset
|
115 // return exportDoubleValue(context, doubleValue); |
9006 | 116 } |
117 | |
118 @Override | |
119 protected NumberFormat createFormatter(final CallContext context) { | |
120 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
121 // digits. | |
122 return Formatter.getUeberflutungsdauer(context); | |
123 } | |
124 }; | |
125 | |
126 public static final UInfoResultType vegdauerbis = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauerbis") { | |
127 private static final long serialVersionUID = 1L; | |
128 | |
129 @Override | |
130 public String exportValue(final CallContext context, final Object value) { | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9006
diff
changeset
|
131 return exportStringValue(value); |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9006
diff
changeset
|
132 // final double doubleValue = asDouble(value); |
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9006
diff
changeset
|
133 // return exportDoubleValue(context, doubleValue); |
9006 | 134 } |
135 | |
136 @Override | |
137 protected NumberFormat createFormatter(final CallContext context) { | |
138 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
139 // digits. | |
140 return Formatter.getUeberflutungsdauer(context); | |
141 } | |
142 }; | |
8996 | 143 } |