Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java @ 9525:967ca59cc11a
Minor cleanup
author | gernotbelger |
---|---|
date | Mon, 01 Oct 2018 18:07:49 +0200 |
parents | bb278c927b66 |
children |
comparison
equal
deleted
inserted
replaced
9524:9dc6427059b2 | 9525:967ca59cc11a |
---|---|
14 import org.dive4elements.river.artifacts.states.SoundingsSelect; | 14 import org.dive4elements.river.artifacts.states.SoundingsSelect; |
15 | 15 |
16 public class BunduAccess extends FixAnalysisAccess { | 16 public class BunduAccess extends FixAnalysisAccess { |
17 | 17 |
18 private static Logger log = Logger.getLogger(BunduAccess.class); | 18 private static Logger log = Logger.getLogger(BunduAccess.class); |
19 | |
20 // Alles, was in super steht, auskommentiert. TODO: endgültig löschen, nachdem ich es etwas verstanden habe | |
21 | |
22 // protected DateRange referencePeriod; | |
23 // protected DateRange[] analysisPeriods; | |
24 // | |
25 // protected double[] qs; | |
26 | 19 |
27 public BunduAccess(final D4EArtifact artifact) { | 20 public BunduAccess(final D4EArtifact artifact) { |
28 super(artifact); | 21 super(artifact); |
29 } | 22 } |
30 | 23 |
53 } | 46 } |
54 | 47 |
55 public Integer getUd() { | 48 public Integer getUd() { |
56 if (getUd_Q_mode().equals("UD")) | 49 if (getUd_Q_mode().equals("UD")) |
57 return getInteger("bundu.wst.ud_value"); | 50 return getInteger("bundu.wst.ud_value"); |
58 else | 51 |
59 return null; | 52 return null; |
60 } | 53 } |
61 | 54 |
62 @Override | 55 @Override |
63 public double[] getQs() { | 56 public double[] getQs() { |
64 if (getUd_Q_mode().equals("Q")) | 57 if (getUd_Q_mode().equals("Q")) |
65 return super.getQs(); | 58 return super.getQs(); |
66 else | 59 |
67 return null; | 60 return null; |
68 } | 61 } |
69 | 62 |
70 private String getUd_Q_mode() { | 63 private String getUd_Q_mode() { |
71 return getString("bundu.wst.mode"); | 64 return getString("bundu.wst.mode"); |
72 } | 65 } |
73 | 66 |
74 public Double getMissingVolFrom() { | 67 public Double getMissingVolFrom() { |
75 if (isCalculateMissingVolume()) | 68 if (isCalculateMissingVolume()) |
76 return getDouble("ld_from_part"); | 69 return getDouble("ld_from_part"); |
77 else | 70 |
78 return null; | 71 return null; |
79 } | 72 } |
80 | 73 |
81 public Double getMissingVolTo() { | 74 public Double getMissingVolTo() { |
82 if (isCalculateMissingVolume()) | 75 if (isCalculateMissingVolume()) |
83 return getDouble("ld_to_part"); | 76 return getDouble("ld_to_part"); |
84 else | 77 |
85 return null; | 78 return null; |
86 } | 79 } |
87 | 80 |
88 public boolean isCalculateMissingVolume() { | 81 public boolean isCalculateMissingVolume() { |
89 return getBoolean("missing_volume"); | 82 return getBoolean("missing_volume"); |
90 } | 83 } |
94 final String data = getString("soundings"); | 87 final String data = getString("soundings"); |
95 | 88 |
96 if (data == null || !isCalculateMissingVolume()) { | 89 if (data == null || !isCalculateMissingVolume()) { |
97 log.warn("No 'soundings' parameter specified!"); | 90 log.warn("No 'soundings' parameter specified!"); |
98 return null; | 91 return null; |
99 } else { | |
100 log.debug("getBedHeightIDs(): data=" + data); | |
101 } | 92 } |
102 | 93 |
103 final String[] parts = data.split(";"); | 94 log.debug("getBedHeightIDs(): data=" + data); |
104 | 95 |
105 int singleID = 0; | 96 int singleID = 0; |
106 | 97 |
107 if (data.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) { | 98 if (data.indexOf(SoundingsSelect.PREFIX_SINGLE) >= 0) { |
108 final String tmp = data.replace(SoundingsSelect.PREFIX_SINGLE, ""); | 99 final String tmp = data.replace(SoundingsSelect.PREFIX_SINGLE, ""); |
113 log.warn("Cannot parse int from string: '" + tmp + "'"); | 104 log.warn("Cannot parse int from string: '" + tmp + "'"); |
114 } | 105 } |
115 } | 106 } |
116 return singleID; | 107 return singleID; |
117 } | 108 } |
118 | |
119 // /** Access the reference date period, return null in case of 'errors'. */ | |
120 // public DateRange getReferencePeriod() { | |
121 // if (this.referencePeriod == null) { | |
122 // final StateData refStart = artifact.getData("ref_start"); | |
123 // final StateData refEnd = artifact.getData("ref_end"); | |
124 // | |
125 // if (refStart == null || refEnd == null) { | |
126 // log.warn("missing 'ref_start' or 'ref_start' value"); | |
127 // return null; | |
128 // } | |
129 // | |
130 // try { | |
131 // long rs = Long.parseLong((String) refStart.getValue()); | |
132 // long re = Long.parseLong((String) refEnd.getValue()); | |
133 // | |
134 // if (rs > re) { | |
135 // final long t = rs; | |
136 // rs = re; | |
137 // re = t; | |
138 // } | |
139 // | |
140 // final Date from = new Date(rs); | |
141 // final Date to = new Date(re); | |
142 // this.referencePeriod = new DateRange(from, to); | |
143 // } | |
144 // catch (final NumberFormatException nfe) { | |
145 // log.warn("ref_start or ref_end is not an integer."); | |
146 // } | |
147 // } | |
148 // | |
149 // return this.referencePeriod; | |
150 // } | |
151 | |
152 // @Override | |
153 // public DateRange[] getAnalysisPeriods() { | |
154 // if (this.analysisPeriods == null) { | |
155 // this.analysisPeriods = getDateRange("ana_data"); | |
156 // } | |
157 // | |
158 // return this.analysisPeriods; | |
159 // } | |
160 | |
161 // /** | |
162 // * @return DateRange object ranging from eldest to youngest date | |
163 // * of analysis and reference periods. | |
164 // */ | |
165 // @Override | |
166 // public DateRange getDateRange() { | |
167 // final DateRange refP = getReferencePeriod(); | |
168 // | |
169 // if (refP == null) { | |
170 // return null; | |
171 // } | |
172 // | |
173 // Date from = refP.getFrom(); | |
174 // Date to = refP.getTo(); | |
175 // | |
176 // final DateRange[] rs = getAnalysisPeriods(); | |
177 // for (final DateRange r : rs) { | |
178 // if (r.getFrom().before(from)) { | |
179 // from = r.getFrom(); | |
180 // } | |
181 // if (r.getTo().after(to)) { | |
182 // to = r.getTo(); | |
183 // } | |
184 // } | |
185 // | |
186 // return new DateRange(from, to); | |
187 // } | |
188 | |
189 // @Override | |
190 // public double[] getQs() { | |
191 // if (this.qs == null) { | |
192 // this.qs = getDoubleArray("qs"); | |
193 // } | |
194 // | |
195 // if (log.isDebugEnabled() && this.qs != null) { | |
196 // log.debug("qs: " + Arrays.toString(this.qs)); | |
197 // } | |
198 // return this.qs; | |
199 // } | |
200 } | 109 } |
201 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |