view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SQResult.java @ 4187:21f4e4b79121

Refactor GaugeDischargeCurveFacet to be able to set a facet name For adding another output of the GaugeDischargeCurveArtifact it is necessary to provide to facet instances with different names. Therefore the GaugeDischargeCurveFacet is extended to set the facet name in the constructor.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 19 Oct 2012 13:25:49 +0200
parents 56f62b5209f5
children
line wrap: on
line source
package de.intevation.flys.artifacts.model.sq;

import java.io.Serializable;



public class SQResult implements Serializable {

    public static final int NUMBER_FRACTIONS = 6;

    public static final int FRACTION_A = 0;
    public static final int FRACTION_B = 1;
    public static final int FRACTION_C = 2;
    public static final int FRACTION_D = 3;
    public static final int FRACTION_E = 4;
    public static final int FRACTION_F = 5;

    protected double km;
    protected SQFractionResult[] fractions;

    public SQResult() {
        this(0d, new SQFractionResult[NUMBER_FRACTIONS]);
    }

    public SQResult(double km, SQFractionResult [] fractions) {
        this.km        = km;
        this.fractions = fractions;
    }

    public SQFractionResult getFraction(int idx) {
        return idx >= 0 && idx < fractions.length
            ? fractions[idx]
            : null;
    }

    public void setFraction(int idx, SQFractionResult fraction) {
        if (idx >= 0 && idx < fractions.length) {
            this.fractions[idx] = fraction;
        }
    }

    public static final String [] FRACTION_NAMES = {
        "A", "B", "C", "D", "E", "F"
    };

    public String getFractionName(int idx) {
        return idx >= 0 && idx < FRACTION_NAMES.length
            ? FRACTION_NAMES[idx]
            : "";
    }

    public double getKm() {
        return km;
    }

    public void setKm(double km) {
        this.km = km;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org