comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultRow.java @ 8948:a4f1ac81f26d

Work on SINFO-FlowDepthMinMax. Also rework of result row stuff, in order to reduce abstraction, using result type concept
author gernotbelger
date Wed, 14 Mar 2018 14:10:32 +0100
parents
children
comparison
equal deleted inserted replaced
8947:86650594f051 8948:a4f1ac81f26d
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.sinfo.common;
11
12 import java.io.Serializable;
13 import java.util.EnumMap;
14 import java.util.Map;
15
16 import org.dive4elements.artifacts.CallContext;
17
18 /**
19 * Generic container for results that come in rows.
20 *
21 * @author Gernot Belger
22 */
23 public final class SInfoResultRow implements Serializable {
24 private static final long serialVersionUID = 1L;
25
26 private final Map<SInfoResultType, Object> values = new EnumMap<>(SInfoResultType.class);
27
28 public static SInfoResultRow create() {
29 return new SInfoResultRow();
30 }
31
32 private SInfoResultRow() {
33 }
34
35 public SInfoResultRow putValue(final SInfoResultType type, final Object value) {
36
37 this.values.put(type, value);
38
39 /* chain me */
40 return this;
41 }
42
43 public String exportValue(final CallContext context, final SInfoResultType type) {
44 final Object value = this.values.get(type);
45 return type.exportValue(context, value);
46 }
47
48 public double getDoubleValue(final SInfoResultType type) {
49 final Object value = this.values.get(type);
50 return type.asDouble(value);
51 }
52
53 public Object getValue(final SInfoResultType type) {
54 return this.values.get(type);
55 }
56 }

http://dive4elements.wald.intevation.org