Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentAccess.java @ 9150:23945061daec
gigantic refactoring: exporter, result, results
to support multiple jaspers -> collisions
author | gernotbelger |
---|---|
date | Thu, 14 Jun 2018 16:56:31 +0200 |
parents | 611a523fc42f |
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.sinfo.flowdepthdev; import java.util.List; import org.dive4elements.river.artifacts.access.RangeAccess; import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; import org.dive4elements.river.artifacts.sinfo.SinfoCalcMode; import org.dive4elements.river.artifacts.sinfo.flowdepth.WstSoundingIdPair; /** * 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 FlowDepthDevelopmentAccess extends RangeAccess { static final String FIELD_DIFFID_CURRENT = "diffid_current"; static final String FIELD_DIFFID_HIST = "diffid_historical"; public FlowDepthDevelopmentAccess(final SINFOArtifact artifact) { super(artifact); /* assert calculation mode */ final SinfoCalcMode calculationMode = artifact.getCalculationMode(); assert (calculationMode == SinfoCalcMode.sinfo_calc_flow_depth_minmax); } public WstSoundingIdPair getCurrentPair() { return getPair(FIELD_DIFFID_CURRENT); } public WstSoundingIdPair getHistoricalPair() { return getPair(FIELD_DIFFID_HIST); } private WstSoundingIdPair getPair(final String field) { final String diffids = getString(field); /* fetch the raw configured pairs */ final List<WstSoundingIdPair> diffPairs = WstSoundingIdPair.parsePairs(diffids); if (diffPairs.size() != 1) return null; return diffPairs.get(0); } }