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@2713: teichmann@5831: import org.dive4elements.artifactdatabase.state.Facet; ingo@2713: teichmann@5831: import org.dive4elements.artifacts.Artifact; teichmann@5831: import org.dive4elements.artifacts.CallContext; ingo@2713: teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; teichmann@5831: teichmann@5831: import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; ingo@2713: ingo@2713: import org.apache.log4j.Logger; ingo@2713: felix@5335: ingo@2713: /** ingo@2713: * Facet of a MiddleBedHeight curve. ingo@2713: */ ingo@2713: public class MiddleBedHeightFacet extends DataFacet { ingo@2713: ingo@2713: private static Logger logger = Logger.getLogger(MiddleBedHeightFacet.class); ingo@2713: ingo@2713: ingo@2713: public MiddleBedHeightFacet() { ingo@2713: // required for clone operation deepCopy() ingo@2713: } ingo@2713: ingo@2713: ingo@2713: public MiddleBedHeightFacet( ingo@2713: int idx, ingo@2713: String name, ingo@2713: String description, ingo@2713: ComputeType type, ingo@2713: String stateId, ingo@2713: String hash ingo@2713: ) { ingo@2713: super(idx, name, description, type, hash, stateId); ingo@2713: } ingo@2713: ingo@2713: ingo@2713: public Object getData(Artifact artifact, CallContext context) { ingo@2713: logger.debug("Get data for middle bed height at index: " + index); ingo@2713: teichmann@5867: D4EArtifact flys = (D4EArtifact) artifact; ingo@2713: ingo@2713: CalculationResult res = (CalculationResult) ingo@2713: flys.compute(context, hash, stateId, type, false); ingo@2713: ingo@2713: MiddleBedHeightData[] data = (MiddleBedHeightData[]) res.getData(); ingo@2713: ingo@2713: return data[index]; ingo@2713: } ingo@2713: ingo@2713: ingo@2713: /** Copy deeply. */ ingo@2713: @Override ingo@2713: public Facet deepCopy() { ingo@2713: MiddleBedHeightFacet copy = new MiddleBedHeightFacet(); ingo@2713: copy.set(this); ingo@2713: copy.type = type; ingo@2713: copy.hash = hash; ingo@2713: copy.stateId = stateId; ingo@2713: return copy; ingo@2713: } ingo@2713: } ingo@2713: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :