teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5994: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.model.minfo; raimund@3898: raimund@3898: import org.apache.log4j.Logger; raimund@3898: teichmann@5831: import org.dive4elements.artifactdatabase.state.Facet; teichmann@5831: import org.dive4elements.artifacts.Artifact; teichmann@5831: import org.dive4elements.artifacts.CallContext; teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; teichmann@5831: import org.dive4elements.river.artifacts.model.CalculationResult; teichmann@5831: import org.dive4elements.river.artifacts.model.DataFacet; teichmann@5831: import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; raimund@3898: raimund@3898: raimund@3898: public class BedDiffEpochFacet raimund@3898: extends DataFacet raimund@3898: { felix@7540: private static Logger logger = Logger.getLogger(BedDiffEpochFacet.class); raimund@3898: raimund@3898: public BedDiffEpochFacet() { raimund@3898: } raimund@3898: raimund@3898: public BedDiffEpochFacet(int idx, String name, String description, raimund@3898: ComputeType type, String stateId, String hash) { raimund@3898: super(idx, name, description, type, hash, stateId); rrenkert@7894: this.metaData.put("X", "chart.longitudinal.section.xaxis.label"); rrenkert@7894: this.metaData.put("Y", "chart.beddifference.height.yaxis.label"); raimund@3898: } raimund@3898: raimund@3898: public Object getData(Artifact artifact, CallContext context) { raimund@3898: logger.debug("Get data for bed density at index: " + index); raimund@3898: teichmann@5867: D4EArtifact flys = (D4EArtifact) artifact; raimund@3898: raimund@3898: CalculationResult res = (CalculationResult) flys.compute(context, hash, raimund@3898: stateId, type, false); raimund@3898: rrenkert@4639: BedDiffEpochResult[] data = rrenkert@4672: (BedDiffEpochResult[]) res.getData(); rrenkert@4639: raimund@3898: return data != null && data.length > index ? data[index] : null; raimund@3898: } raimund@3898: raimund@3898: /** Copy deeply. */ raimund@3898: @Override raimund@3898: public Facet deepCopy() { raimund@3898: BedDiffEpochFacet copy = new BedDiffEpochFacet(); raimund@3898: copy.set(this); raimund@3898: copy.type = type; raimund@3898: copy.hash = hash; raimund@3898: copy.stateId = stateId; raimund@3898: return copy; raimund@3898: } raimund@3898: } raimund@3898: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :