view artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingColumnWithData.java @ 9415:9744ce3c3853

Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets. The facets also put the valid station range into their xml-metadata
author gernotbelger
date Thu, 16 Aug 2018 16:27:53 +0200
parents
children
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
 * Software engineering by
 *  Björnsen Beratende Ingenieure GmbH
 *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
 *
 * 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.fixings;

import java.util.Date;

import org.apache.commons.lang.math.DoubleRange;

/**
 * Helper class to bundle the meta information of a column
 * and the real data.
 */
class FixingColumnWithData {

    private FixingColumn meta;

    private FixingColumnData data;

    private int index;

    public FixingColumnWithData() {
    }

    public FixingColumnWithData(final FixingColumn meta, final FixingColumnData data, final int index) {
        this.meta = meta;
        this.data = data;
        this.index = index;
    }

    public DoubleRange getStationRange() {
        return new DoubleRange(this.meta.getStart(), this.meta.getEnd());
    }

    public Date getDate() {
        return this.meta.getStartTime();
    }

    public String getDescription() {
        return this.meta.getDescription();
    }

    public int getIndex() {
        return this.index;
    }

    public int getId() {
        return this.meta.getId();
    }

    public double getQ(final double km) {
        return this.data.getQ(km);
    }

    public boolean getW(final double km, final double[] ws, final int arrayIndex) {
        return this.data.getW(km, ws, arrayIndex);
    }

    public boolean getQW(final double km, final double[] qs, final double[] ws, final int arrayIndex) {
        qs[this.index] = this.data.getQ(km);
        return this.data.getW(km, ws, arrayIndex);
    }

    public boolean getQW(final double km, final double[] wq) {
        this.data.getW(km, wq, 0);
        if (Double.isNaN(wq[0]))
            return false;
        wq[1] = this.data.getQ(km);
        return !Double.isNaN(wq[1]);
    }
}

http://dive4elements.wald.intevation.org