view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoad.java @ 5645:696d710470f5

flys/issue1077: Show loads as step line, therefore transform data in SedimentLoadFacet to stretch as in the measurement stations bounds. Deal with this new kind of data in the Generator.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 10 Apr 2013 09:35:07 +0200
parents 2fadc6c5cdad
children 7e3cde8b564c
line wrap: on
line source
package de.intevation.flys.artifacts.model.minfo;

import java.util.Date;
import java.util.HashMap;
import java.util.Set;

import de.intevation.flys.artifacts.model.NamedObjectImpl;


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;
    }
}

http://dive4elements.wald.intevation.org