comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java @ 8996:fb9430250899

Work on uinfo
author gernotbelger
date Thu, 12 Apr 2018 19:13:39 +0200
parents
children 7134a4c7d1b6
comparison
equal deleted inserted replaced
8995:8c3e5682cb60 8996:fb9430250899
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
24 public UInfoResultType(final String unit, final String csvHeader) {
25 super(unit, csvHeader, csvHeader);
26
27 }
28
29 @Override
30 public String exportValue(final CallContext context, final Object value) {
31 // TODO Auto-generated method stub
32 return null;
33 }
34
35 @Override
36 protected NumberFormat createFormatter(final CallContext context) {
37 // TODO Auto-generated method stub
38 return null;
39 }
40
41 public static final UInfoResultType salixline = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.salix_line") {
42 @Override
43 public String exportValue(final CallContext context, final Object value) {
44 final double doubleValue = asDouble(value);
45 return exportDoubleValue(context, doubleValue);
46 }
47
48 @Override
49 protected NumberFormat createFormatter(final CallContext context) {
50 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of
51 // digits.
52 return Formatter.getSalixLine(context);
53 }
54 };
55
56 public static final UInfoResultType salixlinehist = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.hist") {
57 @Override
58 public String exportValue(final CallContext context, final Object value) {
59 final double doubleValue = asDouble(value);
60 return exportDoubleValue(context, doubleValue);
61 }
62
63 @Override
64 protected NumberFormat createFormatter(final CallContext context) {
65 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of
66 // digits.
67 return Formatter.getSalixLine(context);
68 }
69 };
70
71 public static final UInfoResultType salixlinescen = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scen") {
72 @Override
73 public String exportValue(final CallContext context, final Object value) {
74 final double doubleValue = asDouble(value);
75 return exportDoubleValue(context, doubleValue);
76 }
77
78 @Override
79 protected NumberFormat createFormatter(final CallContext context) {
80 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of
81 // digits.
82 return Formatter.getSalixLine(context);
83 }
84 };
85
86 }

http://dive4elements.wald.intevation.org