|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.lri.swingstates.sm.State
public abstract class State
A state of a state machine.
This is an inner class of StateMachine and is meant to be used as follows:
StateMachine sm = new StateMachine ("sm") {
...
public State myState = new State() {
... declare transitions ...
}
...
}
The string name of the state, which is used to specify output states in transitions,
will be the name of the field ("myState" in this example).
For this to work, the field must be declared public.
StateMachine| Constructor Summary | |
|---|---|
State()
Builds a new state. |
|
State(java.lang.String n)
Builds a new state with a given name. |
|
| Method Summary | |
|---|---|
void |
addTransition(Transition t)
Adds a transition to this state. |
void |
enter()
The method called when the parent state machine enters this state. |
StateMachine |
getMachine()
|
java.lang.String |
getName()
|
java.util.LinkedList<Transition> |
getTransitions()
|
void |
leave()
The method called when the parent state machine leaves this state. |
java.lang.String |
oldToString()
|
void |
removeTransition(Transition t)
Removes a transition from this state. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public State()
public State(java.lang.String n)
n - The string name of the state, which is used to specify destination state in transitions.| Method Detail |
|---|
public java.lang.String getName()
public StateMachine getMachine()
public java.lang.String oldToString()
toString default method.public java.util.LinkedList<Transition> getTransitions()
public void enter()
State s = new State () {
public void enter () { ... do something ...}
...
}
public void leave()
State s = new State () {
public void leave () { ... do something ...}
...
}
public final void addTransition(Transition t)
t - the transition to add.public final void removeTransition(Transition t)
t - the transition to remove.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||