Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationAccess.java @ 9070:611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
author | gernotbelger |
---|---|
date | Tue, 15 May 2018 18:04:36 +0200 |
parents | 1ffd38826175 |
children | 9b4f5e61c02e |
rev | line source |
---|---|
9069 | 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.uinfo.inundationduration; | |
12 | |
13 import org.dive4elements.river.artifacts.access.RangeAccess; | |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
14 import org.dive4elements.river.artifacts.common.EpochYearAccessHelper; |
9069 | 15 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; |
16 import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode; | |
17 | |
18 /** | |
19 * Access to the flow depth calculation type specific SInfo artifact data. | |
20 * REMARK: this class is NOT intended to be hold in the results (or anywhere else), in order to avoid a permanent | |
21 * reference to the artifact instance. | |
22 * Hence we do NOT cache any data. | |
23 * | |
24 * @author Gernot Belger | |
25 */ | |
26 final class InundationDurationAccess extends RangeAccess { | |
27 | |
28 // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR | |
29 public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR"; | |
30 public static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR"; | |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
31 |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
32 private final EpochYearAccessHelper helper; |
9069 | 33 |
34 // Fields from state: | |
35 // | |
36 // calculation_mode (String) | |
37 // ld_from, ld_to | |
38 // ye_select (String; state.uinfo.totalepoch oder state.uinfo.year) | |
39 // singleyear (String) | |
40 // totalepoch (String; TODO: minmax totalEpoch herausfinden und setzen (nicht hier.. aber trotzdem die Erinnerung hier)) | |
41 // use_scenario boolean (danach kommt kein radioBtn, sondern sedimentheight-Eingabe) | |
42 // sedimentheight String | |
43 // | |
44 // vegzones (String) TODO: MIT VegetationzonesAccess zusammenlegen | |
45 | |
46 public InundationDurationAccess(final UINFOArtifact uinfo) { | |
47 super(uinfo); | |
48 /* assert calculation mode */ | |
49 final UinfoCalcMode calculationMode = uinfo.getCalculationMode(); | |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
50 this.helper = new EpochYearAccessHelper(uinfo); |
9069 | 51 assert (calculationMode == UinfoCalcMode.uinfo_inundation_duration); |
52 } | |
53 | |
54 public Double getSedimentHeight() { | |
55 if (super.getBoolean("use_scenario")) { | |
56 return super.getDouble("sedimentheight"); // TODO: INPUT Valdiation (nicht hier, sondern im Panel. Erinnerung) | |
57 } | |
58 return null; | |
59 } | |
60 | |
61 public Integer getYear() { | |
62 final int[] years = this.helper.getYears("state.uinfo.year", "singleyear"); | |
63 if (years != null) { | |
64 return years[0]; | |
65 } | |
66 return null; | |
67 } | |
68 | |
69 public int[] getTotalEpoch() { | |
70 final int[][] epochs = this.helper.getEpochs("state.uinfo.totalepoch", "totalepoch"); | |
71 if (epochs != null) { | |
72 return epochs[0]; | |
73 } | |
74 return null; | |
75 } | |
76 | |
9070
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
77 public String getVegZones() { |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
78 // MIT VegetationzonesAccess zusammenlegen (eine Zeile sparen...) |
611a523fc42f
VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents:
9069
diff
changeset
|
79 return super.getString("vegzones"); |
9069 | 80 } |
81 | |
82 } |