view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionAccess.java @ 9070:611a523fc42f

VegetationZoneAccessHelper, VegetationTablePanels verbessert
author gernotbelger
date Tue, 15 May 2018 18:04:36 +0200
parents 1ffd38826175
children 766890addcb2
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.sinfo.collision;

import org.dive4elements.river.artifacts.access.RangeAccess;
import org.dive4elements.river.artifacts.common.EpochYearAccessHelper;
import org.dive4elements.river.artifacts.sinfo.SINFOArtifact;
import org.dive4elements.river.artifacts.sinfo.SinfoCalcMode;

/**
 * Access to the flow depth calculation type specific SInfo artifact data.
 * REMARK: this class is NOT intended to be hold in the results (or anywhere else), in order to avoid a permanent
 * reference to the artifact instance.
 * Hence we do NOT cache any data.
 *
 * @author Gernot Belger
 */
final class CollisionAccess extends RangeAccess {

    private final EpochYearAccessHelper helper;

    /// Fields from state:

    // calculation_mode (String), sollte sinfo_calc_collision sein
    // ld_from, ld_to
    // ye_select (String), mögliche werte: "state.sinfo.epoch" "state.sinfo.year"
    // years (String)
    // epochs (String)

    public CollisionAccess(final SINFOArtifact artifact) {
        super(artifact);

        /* assert calculation mode */
        final SinfoCalcMode calculationMode = artifact.getCalculationMode();
        this.helper = new EpochYearAccessHelper(artifact);
        assert (calculationMode == SinfoCalcMode.sinfo_calc_flow_depth);
    }

    public int[] getYears() {
        return this.helper.getYears("state.sinfo.year", "years");
    }

    public int[][] getEpochs() {
        return this.helper.getEpochs("state.sinfo.epoch", "epochs");
    }

}

http://dive4elements.wald.intevation.org