comparison artifacts/src/main/java/org/dive4elements/river/artifacts/transitions/DefaultTransition.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/src/main/java/org/dive4elements/river/artifacts/transitions/DefaultTransition.java@bd047b71ab37
children 4897a58c8746
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.artifacts.transitions;
2
3 import org.w3c.dom.Node;
4
5 import org.dive4elements.artifacts.Artifact;
6
7 import org.dive4elements.artifactdatabase.state.State;
8 import org.dive4elements.artifactdatabase.transition.Transition;
9
10
11 /**
12 * The default implementation of a <code>Transition</code>.
13 *
14 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
15 */
16 public class DefaultTransition implements Transition {
17
18 /** The ID of the current state */
19 protected String from;
20
21 /** The ID of the target state */
22 protected String to;
23
24
25 /**
26 * The default constructor.
27 */
28 public DefaultTransition() {
29 }
30
31
32 /**
33 * The default constructor.
34 *
35 * @param from The current state.
36 * @param to The target state.
37 */
38 public DefaultTransition(String from, String to) {
39 this.from = from;
40 this.to = to;
41 }
42
43
44 public void init(Node config) {
45 // nothing to do in the default transition
46 }
47
48
49 /**
50 * Returns the current state ID.
51 *
52 * @return the current state ID.
53 */
54 public String getFrom() {
55 return from;
56 }
57
58
59 /**
60 * Returns the target state ID.
61 *
62 * @return the target state ID.
63 */
64 public String getTo() {
65 return to;
66 }
67
68
69 /**
70 * Set the current state ID.
71 *
72 * @param from current state ID.
73 */
74 public void setFrom(String from) {
75 this.from = from;
76 }
77
78
79 /**
80 * Set the target state ID.
81 *
82 * @param to the target state ID.
83 */
84 public void setTo(String to) {
85 this.to = to;
86 }
87
88
89 /**
90 * Determines if its valid to step from state <i>a</i> of an artifact
91 * <i>artifact</i> to state <i>b</i>. This method always returns true - no
92 * validation takes place.
93 *
94 * @param artifact The owner artifact of state a and b.
95 * @param a The current state.
96 * @param b The target state.
97 *
98 * @return true, if it is valid to step from a to b, otherwise false.
99 */
100 public boolean isValid(Artifact artifact, State a, State b) {
101 return true;
102 }
103 }
104 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org