view artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java @ 8169:856701739443

Handle missing years in bed height differences without assuming an unknown year to be BC 1.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 01 Sep 2014 09:43:55 +0200
parents 76b5add4f268
children 5c3b36b519d0
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 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 gnu.trove.TDoubleArrayList;


/** Result of a bed diff year calculation. */
public class BedDiffYearResult
extends BedDifferencesResult
{
    protected TDoubleArrayList diffsPerYear;
    protected TDoubleArrayList dataGap;
    protected TDoubleArrayList soundingWidth;
    protected TDoubleArrayList morphWidth1;
    protected TDoubleArrayList morphWidth2;
    protected Integer start;
    protected Integer end;
    protected String nameFirst;
    protected String nameSecond;

    public BedDiffYearResult () {
        super();
        this.diffsPerYear = new TDoubleArrayList();
        this.dataGap = new TDoubleArrayList();
        this.soundingWidth = new TDoubleArrayList();
        this.morphWidth1 = new TDoubleArrayList();
        this.morphWidth2 = new TDoubleArrayList();
    }

    /**
     * @param kms the stations the following parameters are connected to.
     * @param differences the height differences
     * @param heights1 the heights
     * @param heights2 the other heights
     * @param diffsPerYear the differences normalized per year in cm.
     */
    public BedDiffYearResult(
        TDoubleArrayList kms,
        TDoubleArrayList differences,
        TDoubleArrayList heights1,
        TDoubleArrayList heights2,
        TDoubleArrayList morphWidth1,
        TDoubleArrayList morphWidth2,
        TDoubleArrayList soundingWidth,
        TDoubleArrayList diffsPerYear,
        TDoubleArrayList dataGap,
        Integer start,
        Integer end,
        String nameFirst,
        String nameSecond
    ) {
        super(kms, differences, heights1, heights2);
        this.diffsPerYear = diffsPerYear;
        this.dataGap = dataGap;
        this.soundingWidth = soundingWidth;
        this.morphWidth1 = morphWidth1;
        this.morphWidth2 = morphWidth2;
        this.start = start;
        this.end = end;
        this.nameFirst = nameFirst;
        this.nameSecond = nameSecond;
    }

    public TDoubleArrayList getBedHeights() {
        return this.diffsPerYear;
    }

    public TDoubleArrayList getDataGap() {
        return this.dataGap;
    }

    public TDoubleArrayList getMorphWidth1() {
        return this.morphWidth1;
    }

    public TDoubleArrayList getMorphWidth2() {
        return this.morphWidth2;
    }

    public TDoubleArrayList getSoundingWidth() {
        return this.soundingWidth;
    }

    public Integer getStart() {
        return this.start;
    }

    public void setStart(int value) {
        this.start = value;
    }

    public void setEnd(int value) {
        this.end = value;
    }

    public Integer getEnd() {
        return this.end;
    }

    /** Get name of the first BedHeight (minuend). */
    public String getNameFirst() {
        return this.nameFirst;
    }

    /** Get name of the second BedHeight (subtrahend). */
    public String getNameSecond() {
        return this.nameSecond;
    }

    public void addMorphWidth1(double value) {
        this.morphWidth1.add(value);
    }

    public void addMorphWidth2(double value) {
        this.morphWidth2.add(value);
    }

    public void addSoundingWidth(double value) {
        this.soundingWidth.add(value);
    }

    public void addBedHeights(double value) {
        this.diffsPerYear.add(value);
    }

    public double[][] getMorphWidth1Data() {
        return new double[][] {
            kms.toNativeArray(),
            morphWidth1.toNativeArray()
        };
    }

    public double[][] getMorphWidth2Data() {
        return new double[][] {
            kms.toNativeArray(),
            morphWidth2.toNativeArray()
        };
    }

    public double[][] getSoundingWidthData() {
        return new double[][] {
            kms.toNativeArray(),
            soundingWidth.toNativeArray()
        };
    }

    public double[][] getHeightPerYearData() {
        return new double[][] {
            kms.toNativeArray(),
            diffsPerYear.toNativeArray()
        };
    }

    @Override
    public String getDiffDescription() {
        return nameFirst + " - " + nameSecond;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org