Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionAccess.java @ 9067:2ed3824a3d53
sinfo access collision, floodDuration
author | gernotbelger |
---|---|
date | Mon, 14 May 2018 14:59:10 +0200 |
parents | |
children | 1ffd38826175 |
comparison
equal
deleted
inserted
replaced
9066:b5d7a9d79837 | 9067:2ed3824a3d53 |
---|---|
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.collision; | |
12 | |
13 import org.apache.commons.lang.math.DoubleRange; | |
14 import org.dive4elements.river.artifacts.access.RangeAccess; | |
15 import org.dive4elements.river.artifacts.common.AccessHelper; | |
16 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; | |
17 import org.dive4elements.river.artifacts.sinfo.SinfoCalcMode; | |
18 | |
19 /** | |
20 * Access to the flow depth calculation type specific SInfo artifact data. | |
21 * REMARK: this class is NOT intended to be hold in the results (or anywhere else), in order to avoid a permanent | |
22 * reference to the artifact instance. | |
23 * Hence we do NOT cache any data. | |
24 * | |
25 * @author Gernot Belger | |
26 */ | |
27 final class CollisionAccess extends RangeAccess { | |
28 | |
29 private final AccessHelper helper; | |
30 | |
31 /// Fields from state: | |
32 | |
33 // calculation_mode (String), sollte sinfo_calc_collision sein | |
34 // ld_from, ld_to | |
35 // ye_select (String), mögliche werte: "state.sinfo.epoch" "state.sinfo.year" | |
36 // years (String) | |
37 // epochs (String) | |
38 | |
39 public CollisionAccess(final SINFOArtifact artifact) { | |
40 super(artifact); | |
41 | |
42 /* assert calculation mode */ | |
43 final SinfoCalcMode calculationMode = artifact.getCalculationMode(); | |
44 this.helper = new AccessHelper(artifact); | |
45 assert (calculationMode == SinfoCalcMode.sinfo_calc_flow_depth); | |
46 } | |
47 | |
48 public DoubleRange getRange() { | |
49 final double from = getFrom(); | |
50 final double to = getTo(); | |
51 return new DoubleRange(from, to); | |
52 } | |
53 | |
54 public int[] getYears() { | |
55 return this.helper.getYears("state.sinfo.year"); | |
56 } | |
57 | |
58 public int[][] getEpochs() { | |
59 return this.helper.getEpochs("state.sinfo.epoch"); | |
60 } | |
61 | |
62 } |