diff flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoad.java @ 5831:bd047b71ab37

Repaired internal references
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 12:06:39 +0200
parents flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoad.java@9df65e89195e
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoad.java	Thu Apr 25 12:06:39 2013 +0200
@@ -0,0 +1,226 @@
+package org.dive4elements.river.artifacts.model.minfo;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Set;
+
+import org.dive4elements.river.artifacts.model.NamedObjectImpl;
+
+/** Gives access to Fractions (at kms). */
+public class SedimentLoad
+extends NamedObjectImpl
+{
+    protected String description;
+    protected Date start;
+    protected Date end;
+    protected boolean isEpoch;
+
+    protected HashMap<Double, SedimentLoadFraction> kms;
+
+    public SedimentLoad() {
+        kms = new HashMap<Double, SedimentLoadFraction>();
+    }
+
+    public SedimentLoad(
+        String description,
+        Date start,
+        Date end,
+        boolean isEpoch
+    ) {
+        this();
+        this.description = description;
+        this.start = start;
+        this.end = end;
+        this.isEpoch = isEpoch;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Date getStart() {
+        return start;
+    }
+
+    public void setStart(Date start) {
+        this.start = start;
+    }
+
+    public Date getEnd() {
+        return end;
+    }
+
+    public void setEnd(Date end) {
+        this.end = end;
+    }
+
+    public boolean isEpoch() {
+        return isEpoch;
+    }
+
+    public void setEpoch(boolean isEpoch) {
+        this.isEpoch = isEpoch;
+    }
+
+    public Set<Double> getKms() {
+        return kms.keySet();
+    }
+
+    public void addKm(double km, SedimentLoadFraction fraction) {
+        kms.put(km, fraction);
+    }
+
+    public SedimentLoadFraction getFraction(double km) {
+        if (kms.get(km) == null) {
+            return new SedimentLoadFraction();
+        }
+        return kms.get(km);
+    }
+
+    public void setCoarse(double km, double coarse) {
+        if (kms.containsKey(km)) {
+            kms.get(km).setCoarse(coarse);
+        }
+        else {
+            SedimentLoadFraction f = new SedimentLoadFraction();
+            f.setCoarse(coarse);
+            kms.put(km, f);
+        }
+    }
+
+    public void setFineMiddle(double km, double fine_middle) {
+        if (kms.containsKey(km)) {
+            kms.get(km).setFine_middle(fine_middle);
+        }
+        else {
+            SedimentLoadFraction f = new SedimentLoadFraction();
+            f.setFine_middle(fine_middle);
+            kms.put(km, f);
+        }
+    }
+
+    public void setSand(double km, double sand) {
+        if (kms.containsKey(km)) {
+            kms.get(km).setSand(sand);
+        }
+        else {
+            SedimentLoadFraction f = new SedimentLoadFraction();
+            f.setSand(sand);
+            kms.put(km, f);
+        }
+    }
+
+    public void setSuspSand(double km, double susp_sand) {
+        if (kms.containsKey(km)) {
+            kms.get(km).setSusp_sand(susp_sand);
+        }
+        else {
+            SedimentLoadFraction f = new SedimentLoadFraction();
+            f.setSusp_sand(susp_sand);
+            kms.put(km, f);
+        }
+    }
+
+    public void setSuspSandBed(double km, double susp_sand_bed) {
+        if (kms.containsKey(km)) {
+            kms.get(km).setSusp_sand_bed(susp_sand_bed);
+        }
+        else {
+            SedimentLoadFraction f = new SedimentLoadFraction();
+            f.setSusp_sand_bed(susp_sand_bed);
+            kms.put(km, f);
+        }
+    }
+
+    public void setSuspSediment(double km, double susp_sediment) {
+        if (kms.containsKey(km)) {
+            kms.get(km).setSusp_sediment(susp_sediment);
+        }
+        else {
+            SedimentLoadFraction f = new SedimentLoadFraction();
+            f.setSusp_sediment(susp_sediment);
+            kms.put(km, f);
+        }
+    }
+
+    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);
+        }
+        else {
+            SedimentLoadFraction f = new SedimentLoadFraction();
+            f.setTotal(total);
+            kms.put(km, f);
+        }
+    }
+
+    public boolean hasCoarse() {
+        for (SedimentLoadFraction slf : kms.values()) {
+            if (slf.getCoarse() > 0d) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean hasFineMiddle() {
+        for (SedimentLoadFraction slf : kms.values()) {
+            if (slf.getFine_middle() > 0d) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean hasSand() {
+        for (SedimentLoadFraction slf : kms.values()) {
+            if (slf.getSand() > 0d) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean hasSuspSand() {
+        for (SedimentLoadFraction slf : kms.values()) {
+            if (slf.getSusp_sand() > 0d) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean hasSuspSediment() {
+        for (SedimentLoadFraction slf : kms.values()) {
+            if (slf.getSusp_sediment() > 0d) {
+                return true;
+            }
+        }
+        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