teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5863: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5863: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.transitions; ingo@106: ingo@354: import org.w3c.dom.Node; ingo@354: teichmann@5831: import org.dive4elements.artifacts.Artifact; ingo@354: teichmann@5831: import org.dive4elements.artifactdatabase.state.State; teichmann@5831: import org.dive4elements.artifactdatabase.transition.Transition; ingo@106: ingo@354: ingo@106: /** ingo@106: * The default implementation of a Transition. ingo@106: * ingo@106: * @author Ingo Weinzierl ingo@106: */ ingo@106: public class DefaultTransition implements Transition { ingo@106: ingo@106: /** The ID of the current state */ ingo@106: protected String from; ingo@106: ingo@106: /** The ID of the target state */ ingo@106: protected String to; ingo@106: ingo@106: ingo@106: /** ingo@106: * The default constructor. ingo@106: */ ingo@106: public DefaultTransition() { ingo@106: } ingo@106: ingo@106: ingo@106: /** ingo@106: * The default constructor. ingo@106: * ingo@106: * @param from The current state. ingo@106: * @param to The target state. ingo@106: */ ingo@106: public DefaultTransition(String from, String to) { ingo@106: this.from = from; ingo@106: this.to = to; ingo@106: } ingo@106: ingo@106: ingo@354: public void init(Node config) { ingo@354: // nothing to do in the default transition ingo@354: } ingo@354: ingo@354: ingo@106: /** ingo@106: * Returns the current state ID. ingo@106: * ingo@106: * @return the current state ID. ingo@106: */ ingo@106: public String getFrom() { ingo@106: return from; ingo@106: } ingo@106: ingo@106: ingo@106: /** ingo@106: * Returns the target state ID. ingo@106: * ingo@106: * @return the target state ID. ingo@106: */ ingo@106: public String getTo() { ingo@106: return to; ingo@106: } ingo@106: ingo@106: ingo@106: /** ingo@106: * Set the current state ID. ingo@106: * felix@3269: * @param from current state ID. ingo@106: */ ingo@106: public void setFrom(String from) { ingo@106: this.from = from; ingo@106: } ingo@106: ingo@106: ingo@106: /** ingo@106: * Set the target state ID. ingo@106: * ingo@106: * @param to the target state ID. ingo@106: */ ingo@106: public void setTo(String to) { ingo@106: this.to = to; ingo@106: } ingo@106: ingo@106: ingo@106: /** ingo@354: * Determines if its valid to step from state a of an artifact ingo@354: * artifact to state b. This method always returns true - no ingo@354: * validation takes place. ingo@106: * ingo@354: * @param artifact The owner artifact of state a and b. ingo@354: * @param a The current state. ingo@354: * @param b The target state. ingo@106: * ingo@354: * @return true, if it is valid to step from a to b, otherwise false. ingo@106: */ ingo@354: public boolean isValid(Artifact artifact, State a, State b) { ingo@106: return true; ingo@106: } ingo@106: } ingo@106: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :