diff 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
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoad.java	Thu Nov 15 17:38:48 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoad.java	Thu Nov 15 17:44:07 2012 +0100
@@ -17,7 +17,6 @@
     protected Date end;
     protected boolean isEpoch;
 
-    /** Maps kms. */
     protected HashMap<Double, SedimentLoadFraction> kms;
 
     public SedimentLoad() {
@@ -150,6 +149,17 @@
         }
     }
 
+    public void setLoadTotal(double km, double total) {
+        if (kms.containsKey(km)) {
+            kms.get(km).setLoadTotal(total);
+        }
+        else {
+            SedimentLoadFraction f = new SedimentLoadFraction();
+            f.setLoadTotal(total);
+            kms.put(km, f);
+        }
+    }
+
     public void setTotal(double km, double total) {
         if (kms.containsKey(km)) {
             kms.get(km).setTotal(total);
@@ -205,5 +215,13 @@
         }
         return false;
     }
+
+    public boolean hasTotalLoad() {
+        for (SedimentLoadFraction slf : kms.values()) {
+            if (slf.getLoadTotal() > 0d) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org