|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.lri.swingstates.sm.Transition
public abstract class Transition
A transition of a state machine.
This is an inner class of StateMachine.State and is meant to
be used as follows:
Transition t = new <eventtype> (<parameters>, <output state>) {
public boolean guard () { ... return True if transitions enabled ... } // optional
public void action () { ... transition action ... } // optional
}
The Transition class has many derived classes corresponding to the various types of events that can be handled by a state machine.
<eventtype> represents one of these classes and <parameters> the corresponding parameters.
<output state> is the specification of the output state of the transition.
It is a string containing the name of the output state, which is, in general, the name of the
field of the state machine that holds the state (see class StateMachine.State).
In order to make it easier to spot the output state in the declaration, the name can be prefixed by
any combination of the following characters: -, =, > and space. This makes it possible to
specify a transition to state s2 with strings such as "-> s2", "==> s2", ">> s2", etc.
StateMachine| Method Summary | |
|---|---|
void |
action()
Method called when this transition is fired. |
java.util.EventObject |
getEvent()
Returns the event that has just been received. |
State |
getInputState()
|
State |
getOutputState()
|
boolean |
guard()
Method called when an event matching this transition is received to decide whether it can be fired. |
boolean |
matches(java.util.EventObject eventObject)
Tests if an event can trigger that transition. |
java.lang.String |
oldToString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public State getOutputState()
public State getInputState()
public boolean matches(java.util.EventObject eventObject)
eventObject - The event to test
eventObject
can trigger this transition.public java.lang.String oldToString()
public boolean guard()
Transition t = new Press (BUTTON1) {
public boolean guard() { ... return true or false ... }
}
public void action()
Transition t = new Press (BUTTON1) {
public void action() { ... do something ... }
}
public java.util.EventObject getEvent()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||