view artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataResult.java @ 8587:07c9ac22f611

(issue1755) Generalise BedQuality result handling The bedquality calculation now produces a result for each time period which has BedQualityResultValues for each specific result type. Formally this was split up in density, porosity and diameter classes with some bedload diameter classes mixed in for extra fun. The intent of this commit is to allow more shared code and generic access patterns to the BedQuality results.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 18 Mar 2015 18:42:08 +0100
parents 4b2b7593815c
children
line wrap: on
line source
/* Copyright (C) 2016 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */
package org.dive4elements.river.artifacts.model.minfo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class SedimentLoadDataResult
implements   Serializable
{

    public static class Fraction implements Serializable {
        private String      name;
        /* Period is the validity of the result. It is either a single
         * year or a range of years (epoch). As this is only used for
         * presentation purposes the type is a string so that years
         * and epochs need not be handled differently.*/
        private String      period;
        private double [][] data;

        public Fraction() {
        }

        public Fraction(String name, double [][] data, String period) {
            this.name = name;
            this.data = data;
            this.period = period;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public double [][] getData() {
            return data;
        }

        public void setData(double [][] data) {
            this.data = data;
        }

        public void setPeriod(String period) {
            this.period = period;
        }

        public String getPeriod() {
            return period;
        }

    } // class Fraction

    private List<Fraction> fractions;

    public SedimentLoadDataResult() {
        fractions = new ArrayList<Fraction>();
    }

    public void addFraction(Fraction fraction) {
        fractions.add(fraction);
    }

    public List<Fraction> getFractions() {
        return fractions;
    }

    public List<Fraction> getFractionsByName(String name) {
        List<Fraction> result = new ArrayList<Fraction>();
        for (Fraction fraction: fractions) {
            if (fraction.getName().equals(name)) {
                result.add(fraction);
            }
        }
        return result.isEmpty() ? null : result;
    }

}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org