raimund@3898: package de.intevation.flys.artifacts.model.minfo; raimund@3898: raimund@3898: import org.apache.log4j.Logger; raimund@3898: raimund@3898: import de.intevation.artifactdatabase.state.Facet; raimund@3898: import de.intevation.artifacts.Artifact; raimund@3898: import de.intevation.artifacts.CallContext; raimund@3898: import de.intevation.flys.artifacts.FLYSArtifact; raimund@3898: import de.intevation.flys.artifacts.model.CalculationResult; raimund@3898: import de.intevation.flys.artifacts.model.DataFacet; raimund@3898: import de.intevation.flys.artifacts.states.DefaultState.ComputeType; raimund@3898: raimund@3898: raimund@3898: public class BedDiffYearFacet raimund@3898: extends DataFacet raimund@3898: { raimund@3898: private static Logger logger = Logger.getLogger(BedDiffYearFacet.class); raimund@3898: raimund@3898: public BedDiffYearFacet() { raimund@3898: } raimund@3898: raimund@3898: public BedDiffYearFacet(int idx, String name, String description, raimund@3898: ComputeType type, String stateId, String hash) { raimund@3898: super(idx, name, description, type, hash, stateId); 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: raimund@3898: FLYSArtifact flys = (FLYSArtifact) artifact; raimund@3898: raimund@3898: CalculationResult res = (CalculationResult) flys.compute(context, hash, raimund@3898: stateId, type, false); raimund@3898: raimund@3898: Object[] data = raimund@3898: (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS raimund@3898: 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: BedDiffYearFacet copy = new BedDiffYearFacet(); 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 :