teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5863: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5863: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.model; ingo@2311: ingo@2311: import org.apache.log4j.Logger; ingo@2311: teichmann@5831: import org.dive4elements.artifacts.Artifact; teichmann@5831: import org.dive4elements.artifacts.CallContext; ingo@2311: teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; teichmann@5831: import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; ingo@2311: ingo@2311: ingo@2311: /** felix@5343: * Difference of historical discharge curve to ... ingo@2311: * @author Ingo Weinzierl ingo@2311: */ ingo@2311: public class HistoricalDischargeDifferenceFacet ingo@2311: extends HistoricalDischargeFacet ingo@2311: { ingo@2311: private static final Logger logger = ingo@2311: Logger.getLogger(HistoricalDischargeDifferenceFacet.class); ingo@2311: ingo@2311: ingo@2311: public HistoricalDischargeDifferenceFacet( ingo@2311: int index, ingo@2311: String name, ingo@2311: String desc ingo@2311: ) { ingo@2311: super(index, name, desc, ComputeType.ADVANCE, null, null); ingo@2311: } ingo@2311: ingo@2311: ingo@2311: public HistoricalDischargeDifferenceFacet( ingo@2311: int index, ingo@2311: String name, ingo@2311: String description, ingo@2311: ComputeType type, ingo@2311: String stateID, ingo@2311: String hash ingo@2311: ingo@2311: ) { ingo@2311: super(index, name, description, type, hash, stateID); ingo@2311: } ingo@2311: ingo@2311: ingo@2311: @Override ingo@2311: public Object getData(Artifact artifact, CallContext context) { ingo@2311: if (logger.isDebugEnabled()) { ingo@2311: logger.debug("Get data for historical discharge difference curves" + ingo@2311: " at index: " + index + " / stateId: " + stateId); ingo@2311: } ingo@2311: teichmann@5867: D4EArtifact flys = (D4EArtifact) artifact; ingo@2311: ingo@2311: CalculationResult res = (CalculationResult) ingo@2311: flys.compute(context, hash, stateId, type, false); ingo@2311: ingo@4241: HistoricalDischargeData data = (HistoricalDischargeData) res.getData(); ingo@4241: WQTimerange[] wqts = (WQTimerange[]) data.getWQTimeranges(); ingo@2311: ingo@2311: return wqts[index]; ingo@2311: } ingo@2311: } ingo@2311: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :