Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxAccess.java @ 8993:0adc6d04de95
SInfo - FlowDepthMinMax: choosing bed heights, not bed height min and max separately
author | gernotbelger |
---|---|
date | Wed, 11 Apr 2018 14:09:13 +0200 |
parents | 5d5d482da3e9 |
children | 611a523fc42f |
rev | line source |
---|---|
8946 | 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 | |
11 package org.dive4elements.river.artifacts.sinfo.flowdepthminmax; | |
12 | |
13 import java.util.Collection; | |
14 | |
15 import org.apache.commons.lang.math.DoubleRange; | |
16 import org.dive4elements.river.artifacts.access.RangeAccess; | |
17 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; | |
18 import org.dive4elements.river.artifacts.sinfo.SinfoCalcMode; | |
19 import org.dive4elements.river.artifacts.sinfo.flowdepth.WstSoundingIdPair; | |
20 | |
21 /** | |
22 * Access to the flow depth calculation type specific SInfo artifact data. | |
23 * REMARK: this class is NOT intended to be hold in the results (or anywhere else), in order to avoid a permanent | |
24 * reference to the artifact instance. | |
25 * Hence we do NOT cache any data. | |
26 * | |
27 * @author Gernot Belger | |
28 */ | |
29 final class FlowDepthMinMaxAccess extends RangeAccess { | |
30 | |
31 private static final String FIELD_DIFFIDS = "diffids"; | |
32 | |
33 public FlowDepthMinMaxAccess(final SINFOArtifact artifact) { | |
34 super(artifact); | |
35 | |
36 /* assert calculation mode */ | |
37 final SinfoCalcMode calculationMode = artifact.getCalculationMode(); | |
38 assert (calculationMode == SinfoCalcMode.sinfo_calc_flow_depth_minmax); | |
39 } | |
40 | |
41 public DoubleRange getRange() { | |
42 final double from = getFrom(); | |
43 final double to = getTo(); | |
44 return new DoubleRange(from, to); | |
45 } | |
46 | |
8993
0adc6d04de95
SInfo - FlowDepthMinMax: choosing bed heights, not bed height min and max separately
gernotbelger
parents:
8946
diff
changeset
|
47 public Collection<WstSoundingIdPair> getMinMaxPairs() { |
8946 | 48 final String diffids = getString(FIELD_DIFFIDS); |
8993
0adc6d04de95
SInfo - FlowDepthMinMax: choosing bed heights, not bed height min and max separately
gernotbelger
parents:
8946
diff
changeset
|
49 return WstSoundingIdPair.parsePairs(diffids); |
8946 | 50 } |
51 } |