view artifacts/src/main/java/org/dive4elements/river/artifacts/transitions/DefaultTransition.java @ 8755:30b1ddadf275

(issue1801) Unify reference gauge finding code The basic way as described in the method comment of the determineRefGauge method is now used in the WINFOArtifact, MainValuesService and RiverUtils.getGauge method. RiverUtils.getGauge previously just returned the first gauge found. While this is now a behavior change I believe that it is always more correct then the undeterministic behavior of the previous implmenentation.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 24 Jun 2015 14:07:26 +0200
parents af13ceeba52a
children
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.artifacts.transitions;

import org.w3c.dom.Node;

import org.dive4elements.artifacts.Artifact;

import org.dive4elements.artifactdatabase.state.State;
import org.dive4elements.artifactdatabase.transition.Transition;


/**
 * The default implementation of a <code>Transition</code>.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class DefaultTransition implements Transition {

    /** The ID of the current state */
    protected String from;

    /** The ID of the target state */
    protected String to;


    /**
     * The default constructor.
     */
    public DefaultTransition() {
    }


    /**
     * The default constructor.
     *
     * @param from The current state.
     * @param to The target state.
     */
    public DefaultTransition(String from, String to) {
        this.from = from;
        this.to   = to;
    }


    public void init(Node config) {
        // nothing to do in the default transition
    }


    /**
     * Returns the current state ID.
     *
     * @return the current state ID.
     */
    public String getFrom() {
        return from;
    }


    /**
     * Returns the target state ID.
     *
     * @return the target state ID.
     */
    public String getTo() {
        return to;
    }


    /**
     * Set the current state ID.
     *
     * @param from current state ID.
     */
    public void setFrom(String from) {
        this.from = from;
    }


    /**
     * Set the target state ID.
     *
     * @param to the target state ID.
     */
    public void setTo(String to) {
        this.to = to;
    }


    /**
     * Determines if its valid to step from state <i>a</i> of an artifact
     * <i>artifact</i> to state <i>b</i>. This method always returns true - no
     * validation takes place.
     *
     * @param artifact The owner artifact of state a and b.
     * @param a The current state.
     * @param b The target state.
     *
     * @return true, if it is valid to step from a to b, otherwise false.
     */
    public boolean isValid(Artifact artifact, State a, State b) {
        return true;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org