comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoad.java @ 4546:af1938d4e957

New field in sediment load object and calculation. * Factory reads total load value. * New field in sediment load object. * State adds new facet to generate output for this type of data.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 15 Nov 2012 17:44:07 +0100
parents 17d896822d70
children 2fadc6c5cdad
comparison
equal deleted inserted replaced
4545:bb8b1c182913 4546:af1938d4e957
15 protected String description; 15 protected String description;
16 protected Date start; 16 protected Date start;
17 protected Date end; 17 protected Date end;
18 protected boolean isEpoch; 18 protected boolean isEpoch;
19 19
20 /** Maps kms. */
21 protected HashMap<Double, SedimentLoadFraction> kms; 20 protected HashMap<Double, SedimentLoadFraction> kms;
22 21
23 public SedimentLoad() { 22 public SedimentLoad() {
24 kms = new HashMap<Double, SedimentLoadFraction>(); 23 kms = new HashMap<Double, SedimentLoadFraction>();
25 } 24 }
148 f.setSusp_sediment(susp_sediment); 147 f.setSusp_sediment(susp_sediment);
149 kms.put(km, f); 148 kms.put(km, f);
150 } 149 }
151 } 150 }
152 151
152 public void setLoadTotal(double km, double total) {
153 if (kms.containsKey(km)) {
154 kms.get(km).setLoadTotal(total);
155 }
156 else {
157 SedimentLoadFraction f = new SedimentLoadFraction();
158 f.setLoadTotal(total);
159 kms.put(km, f);
160 }
161 }
162
153 public void setTotal(double km, double total) { 163 public void setTotal(double km, double total) {
154 if (kms.containsKey(km)) { 164 if (kms.containsKey(km)) {
155 kms.get(km).setTotal(total); 165 kms.get(km).setTotal(total);
156 } 166 }
157 else { 167 else {
203 return true; 213 return true;
204 } 214 }
205 } 215 }
206 return false; 216 return false;
207 } 217 }
218
219 public boolean hasTotalLoad() {
220 for (SedimentLoadFraction slf : kms.values()) {
221 if (slf.getLoadTotal() > 0d) {
222 return true;
223 }
224 }
225 return false;
226 }
208 } 227 }
209 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org