Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionAccess.java @ 9069:1ffd38826175
access uinfo.vegetationzones+inundation_duration
author | gernotbelger |
---|---|
date | Tue, 15 May 2018 12:00:26 +0200 |
parents | 2ed3824a3d53 |
children | 611a523fc42f |
rev | line source |
---|---|
9067 | 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() { | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9067
diff
changeset
|
55 return this.helper.getYears("state.sinfo.year", "years"); |
9067 | 56 } |
57 | |
58 public int[][] getEpochs() { | |
9069
1ffd38826175
access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
9067
diff
changeset
|
59 return this.helper.getEpochs("state.sinfo.epoch", "epochs"); |
9067 | 60 } |
61 | |
62 } |