|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsm.StateMachine.State.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 handeled by a state machine.
<eventtype>
represents one of these classes and <parameters> the corresponding parameters.
The complete list of events is given below, refer to the corresponding classes for further details.
<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.
The complete list of event types is:
Press, PressOnShape, PressOnTag
: pressing a mouse button (anywhere / on a shape / on a shape with a given tag);
Release, ReleaseOnShape, ReleaseOnTag
: releasing a mouse button (anywhere / on a shape / on a shape with a given tag);
Click, ClickOnShape, ClickOnTag
: clicking (pressing and releasing in quick succession) a mouse button (anywhere / on a shape / on a shape with a given tag);
Move, MoveOnShape, MoveOnTag
: moving the mouse with no button pressed (anywhere / on a shape / on a shape with a given tag);
Drag, DragOnShape, DragOnTag
: moving the mouse with a button pressed (anywhere / on a shape / on a shape with a given tag);
EnterOnShape, EnterOnTag
: cursor enters a shape / a shape with a given tag;
LeaveOnShape, LeaveOnTag
: cursor leaves a shaoe / a shape with a given tag;
KeyPress, KeyRelease, KeyType
: typing a key (pressing, releasing, press then release in quick succession);
TimeOut
: delay specified by armTimer expired.
StateMachine
Constructor Summary | |
StateMachine.State.Transition(java.lang.String e)
Constructs a transition with any modifier that loops on the current state. |
|
StateMachine.State.Transition(java.lang.String e,
int m)
Constructs a transition with a modifier that loops on the current state. |
|
StateMachine.State.Transition(java.lang.String e,
int m,
java.lang.String a)
Constructs a transition with a modifier. |
|
StateMachine.State.Transition(java.lang.String e,
java.lang.String a)
Constructs a transition with any modifier. |
Method Summary | |
void |
action()
Method called when this transition is fired. |
int |
getModifier()
Returns the modifier of the event that fires this transition. |
StateMachine.State |
getOutputStateName()
|
SMVirtualEvent |
getVirtualEvent()
|
boolean |
guard()
Method called when an event matching this transition is received to decide whether it can be fired. |
java.lang.String |
hashKey()
Returns the hashkey of this transition. |
java.lang.String |
oldToString()
|
void |
setVirtualEvent(SMVirtualEvent virtualEvent)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StateMachine.State.Transition(java.lang.String e, java.lang.String a)
e
- The string describing the events for which this transition must be triggered: "Down", "Motion", "Move", "Up", "Click", "KeyPress", "KeyType", "KeyRelease", "Timeout" or "Gesture"*a
- The name of the output statepublic StateMachine.State.Transition(java.lang.String e, int m, java.lang.String a)
e
- The string describing the events for which this transition must be triggered: "Down", "Motion", "Move", "Up", "Click", "KeyPress", "KeyType", "KeyRelease", "Timeout" or "Gesture"*m
- The modifier: NOMODIFIER, CONTROL, ALT, SHIFT, ALT_CONTROL, CONTROL_SHIFT, ALT_SHIFT or ALT_CONTROL_SHIFTa
- The name of the output statepublic StateMachine.State.Transition(java.lang.String e)
e
- The string describing the events for which this transition must be triggered: "Down", "Motion", "Move", "Up", "Click", "KeyPress", "KeyType", "KeyRelease", "Timeout" or "Gesture"*public StateMachine.State.Transition(java.lang.String e, int m)
e
- The string describing the events for which this transition must be triggered: "Down", "Motion", "Move", "Up", "Click", "KeyPress", "KeyType", "KeyRelease", "Timeout" or "Gesture"*m
- The modifier: NOMODIFIER, CONTROL, ALT, SHIFT, ALT_CONTROL, CONTROL_SHIFT, ALT_SHIFT or ALT_CONTROL_SHIFTMethod Detail |
public int getModifier()
public StateMachine.State getOutputStateName()
public java.lang.String hashKey()
public java.lang.String oldToString()
public java.lang.String toString()
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 SMVirtualEvent getVirtualEvent()
public void setVirtualEvent(SMVirtualEvent virtualEvent)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |