teichmann@5831: package org.dive4elements.river.artifacts.model; ingo@2706: teichmann@5831: import org.dive4elements.artifactdatabase.state.Facet; ingo@2706: teichmann@5831: import org.dive4elements.artifacts.Artifact; teichmann@5831: import org.dive4elements.artifacts.CallContext; ingo@2706: teichmann@5831: import org.dive4elements.river.artifacts.FLYSArtifact; teichmann@5831: teichmann@5831: import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; ingo@2706: ingo@2706: import org.apache.log4j.Logger; ingo@2706: ingo@2706: /** ingo@2706: * Facet of a FlowVelocity curve. ingo@2706: */ ingo@2706: public class FlowVelocityFacet extends DataFacet { ingo@2706: ingo@2706: private static Logger logger = Logger.getLogger(FlowVelocityFacet.class); ingo@2706: ingo@2706: public FlowVelocityFacet() { ingo@2706: // required for clone operation deepCopy() ingo@2706: } ingo@2706: ingo@2706: ingo@2706: public FlowVelocityFacet( ingo@2706: int idx, ingo@2706: String name, ingo@2706: String description, ingo@2706: ComputeType type, ingo@2706: String stateId, ingo@2706: String hash ingo@2706: ) { ingo@2706: super(idx, name, description, type, hash, stateId); ingo@2706: } ingo@2706: ingo@2706: ingo@2706: public Object getData(Artifact artifact, CallContext context) { ingo@2706: logger.debug("Get data for flow velocity at index: " + index); ingo@2706: ingo@2706: FLYSArtifact flys = (FLYSArtifact) artifact; ingo@2706: ingo@2706: CalculationResult res = (CalculationResult) ingo@2706: flys.compute(context, hash, stateId, type, false); ingo@2706: ingo@2706: FlowVelocityData[] data = (FlowVelocityData[]) res.getData(); ingo@2706: ingo@2706: return data[index]; ingo@2706: } ingo@2706: ingo@2706: ingo@2706: /** Copy deeply. */ ingo@2706: @Override ingo@2706: public Facet deepCopy() { ingo@2706: FlowVelocityFacet copy = new FlowVelocityFacet(); ingo@2706: copy.set(this); ingo@2706: copy.type = type; ingo@2706: copy.hash = hash; ingo@2706: copy.stateId = stateId; ingo@2706: return copy; ingo@2706: } ingo@2706: } ingo@2706: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :