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
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
1 /* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
2 * Software engineering by
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
3 * Björnsen Beratende Ingenieure GmbH
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
5 *
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
6 * This file is Free Software under the GNU AGPL (>=v3)
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
8 * documentation coming with Dive4Elements River for details.
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
9 */
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
10
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
11 package org.dive4elements.river.artifacts.uinfo.inundationduration;
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
12
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
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
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
15 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
16 import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode;
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
17
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
18 /**
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
19 * Access to the flow depth calculation type specific SInfo artifact data.
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
20 * REMARK: this class is NOT intended to be hold in the results (or anywhere else), in order to avoid a permanent
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
21 * reference to the artifact instance.
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
22 * Hence we do NOT cache any data.
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
23 *
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
24 * @author Gernot Belger
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
25 */
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
26 final class InundationDurationAccess extends RangeAccess {
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
27
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
28 // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
29 public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
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
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
33
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
34 // Fields from state:
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
35 //
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
36 // calculation_mode (String)
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
37 // ld_from, ld_to
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
38 // ye_select (String; state.uinfo.totalepoch oder state.uinfo.year)
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
39 // singleyear (String)
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
40 // totalepoch (String; TODO: minmax totalEpoch herausfinden und setzen (nicht hier.. aber trotzdem die Erinnerung hier))
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
41 // use_scenario boolean (danach kommt kein radioBtn, sondern sedimentheight-Eingabe)
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
42 // sedimentheight String
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
43 //
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
44 // vegzones (String) TODO: MIT VegetationzonesAccess zusammenlegen
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
45
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
46 public InundationDurationAccess(final UINFOArtifact uinfo) {
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
47 super(uinfo);
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
48 /* assert calculation mode */
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
49 final UinfoCalcMode calculationMode = uinfo.getCalculationMode();
9070
611a523fc42f VegetationZoneAccessHelper, VegetationTablePanels verbessert
gernotbelger
parents: 9069
diff changeset
50 this.helper = new EpochYearAccessHelper(uinfo);
9069
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
51 assert (calculationMode == UinfoCalcMode.uinfo_inundation_duration);
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
52 }
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
53
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
54 public Double getSedimentHeight() {
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
55 if (super.getBoolean("use_scenario")) {
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
56 return super.getDouble("sedimentheight"); // TODO: INPUT Valdiation (nicht hier, sondern im Panel. Erinnerung)
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
57 }
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
58 return null;
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
59 }
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
60
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
61 public Integer getYear() {
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
62 final int[] years = this.helper.getYears("state.uinfo.year", "singleyear");
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
63 if (years != null) {
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
64 return years[0];
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
65 }
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
66 return null;
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
67 }
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
68
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
69 public int[] getTotalEpoch() {
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
70 final int[][] epochs = this.helper.getEpochs("state.uinfo.totalepoch", "totalepoch");
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
71 if (epochs != null) {
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
72 return epochs[0];
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
73 }
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
74 return null;
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
75 }
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
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
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
80 }
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
81
1ffd38826175 access uinfo.vegetationzones+inundation_duration
gernotbelger
parents:
diff changeset
82 }

http://dive4elements.wald.intevation.org