comparison 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
comparison
equal deleted inserted replaced
9069:1ffd38826175 9070:611a523fc42f
8 * documentation coming with Dive4Elements River for details. 8 * documentation coming with Dive4Elements River for details.
9 */ 9 */
10 10
11 package org.dive4elements.river.artifacts.uinfo.inundationduration; 11 package org.dive4elements.river.artifacts.uinfo.inundationduration;
12 12
13 import java.util.ArrayList;
14
15 import org.apache.commons.lang.math.DoubleRange;
16 import org.dive4elements.river.artifacts.access.RangeAccess; 13 import org.dive4elements.river.artifacts.access.RangeAccess;
17 import org.dive4elements.river.artifacts.common.AccessHelper; 14 import org.dive4elements.river.artifacts.common.EpochYearAccessHelper;
18 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; 15 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
19 import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode; 16 import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode;
20 17
21 /** 18 /**
22 * Access to the flow depth calculation type specific SInfo artifact data. 19 * Access to the flow depth calculation type specific SInfo artifact data.
29 final class InundationDurationAccess extends RangeAccess { 26 final class InundationDurationAccess extends RangeAccess {
30 27
31 // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR 28 // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR
32 public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR"; 29 public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
33 public static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR"; 30 public static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR";
34 private final AccessHelper helper; 31
32 private final EpochYearAccessHelper helper;
35 33
36 // Fields from state: 34 // Fields from state:
37 // 35 //
38 // calculation_mode (String) 36 // calculation_mode (String)
39 // ld_from, ld_to 37 // ld_from, ld_to
45 // 43 //
46 // vegzones (String) TODO: MIT VegetationzonesAccess zusammenlegen 44 // vegzones (String) TODO: MIT VegetationzonesAccess zusammenlegen
47 45
48 public InundationDurationAccess(final UINFOArtifact uinfo) { 46 public InundationDurationAccess(final UINFOArtifact uinfo) {
49 super(uinfo); 47 super(uinfo);
50
51 /* assert calculation mode */ 48 /* assert calculation mode */
52 final UinfoCalcMode calculationMode = uinfo.getCalculationMode(); 49 final UinfoCalcMode calculationMode = uinfo.getCalculationMode();
53 this.helper = new AccessHelper(uinfo); 50 this.helper = new EpochYearAccessHelper(uinfo);
54 assert (calculationMode == UinfoCalcMode.uinfo_inundation_duration); 51 assert (calculationMode == UinfoCalcMode.uinfo_inundation_duration);
55 }
56
57 public DoubleRange getRange() {
58 final double from = getFrom();
59 final double to = getTo();
60 return new DoubleRange(from, to);
61 } 52 }
62 53
63 public Double getSedimentHeight() { 54 public Double getSedimentHeight() {
64 if (super.getBoolean("use_scenario")) { 55 if (super.getBoolean("use_scenario")) {
65 return super.getDouble("sedimentheight"); // TODO: INPUT Valdiation (nicht hier, sondern im Panel. Erinnerung) 56 return super.getDouble("sedimentheight"); // TODO: INPUT Valdiation (nicht hier, sondern im Panel. Erinnerung)
81 return epochs[0]; 72 return epochs[0];
82 } 73 }
83 return null; 74 return null;
84 } 75 }
85 76
86 public ArrayList<String[]> getVegZones() { 77 public String getVegZones() {
87 // TODO: MIT VegetationzonesAccess zusammenlegen 78 // MIT VegetationzonesAccess zusammenlegen (eine Zeile sparen...)
88 final ArrayList<String[]> results = new ArrayList<>(); 79 return super.getString("vegzones");
89 final String zonesRaw = super.getString("vegzones");
90 if (zonesRaw.contains(TABLE_ROW_SEPARATOR)) {
91 final String[] rows = zonesRaw.split(TABLE_ROW_SEPARATOR);
92 for (final String row : rows) {
93 if (row.contains(TABLE_CELL_SEPARATOR)) {
94 final String[] result = row.split(TABLE_CELL_SEPARATOR);
95 results.add(result);
96 }
97 }
98 }
99 return results;
100 } 80 }
101 81
102 } 82 }

http://dive4elements.wald.intevation.org