view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFacet.java @ 4534:1619f80eb62e

Add type member variable to BedHeightFacet The type can either be single, epoch or singlevalues.
author Björn Ricks <bjoern.ricks@intevation.de>
date Thu, 15 Nov 2012 16:18:02 +0100
parents ebfce31c7eec
children cd44d28d0fbc
line wrap: on
line source
package de.intevation.flys.artifacts.model.minfo;

import de.intevation.artifacts.Artifact;
import de.intevation.artifacts.CallContext;
import de.intevation.flys.artifacts.BedHeightsArtifact;
import de.intevation.flys.artifacts.model.BlackboardDataFacet;
import de.intevation.flys.artifacts.model.FacetTypes;

public class BedHeightFacet
extends      BlackboardDataFacet
implements   FacetTypes {

    private String type;

    public BedHeightFacet(String name, String description, String type) {
        this.name = name;
        this.description = description;
        this.type = type;
        this.index = 0;
    }

    /**
     * Returns the data this facet requires.
     *
     * @param artifact the owner artifact.
     * @param context  the CallContext (ignored).
     *
     * @return the data.
     */
    @Override
    public Object getData(Artifact artifact, CallContext context) {
        BedHeightsArtifact staticData =
            (BedHeightsArtifact) artifact;
        if (type.equals("singlevalues")) {
            return staticData.getSingleValues();
        }
        return staticData.getHeight();
    }
    /**
     * Create a deep copy of this Facet.
     * @return a deep copy.
     */
    @Override
    public BedHeightFacet deepCopy() {
        BedHeightFacet copy = new BedHeightFacet(name, description, type);
        copy.set(this);
        return copy;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org