view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFacet.java @ 4826:a3dc382bc1ca

BedHeightAccess, FlowVelocityAccess, SedimentLoadAccess: Inherit from RangeAccess. Update callers.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 21 Jan 2013 17:26:08 +0100
parents cd44d28d0fbc
children
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.FLYSArtifact;
import de.intevation.flys.artifacts.access.BedHeightAccess;
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) {
        BedHeightAccess access = new BedHeightAccess((FLYSArtifact)artifact, context);
        if (type.equals("singlevalues")) {
            return access.getSingleValues();
        }
        return access.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