|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsm.StateMachine.State.Transition
sm.StateMachine.State.Event
A transition triggered in the canvas.
The Event
class can be directly used or extended to define specific event.
The above example shows how a state machine, sm1
, can receive "longPress" events provided
by another state machine, sm2
.
StateMachine sm1, sm2; ... sm1 = new StateMachine("sm1", c) { public State start = new State("start") { public Transition event = new Event("longPress") { public void action() { System.out.println("a long press event"); } }; }; }; sm2 = new StateMachine("sm2", c) { public State start = new State("start") { public Transition press = new Press(BUTTON1, ">> wait") { public void action() { armTimer(1000); } }; }; public State wait = new State("wait") { public Transition release = new Release(BUTTON1, ">> start") { public void action() { disarmTimer(); } }; public Transition longPress = new TimeOut(">> start") { public void action() { sm1.processEvent(new SMVirtualEvent("longPress")); } }; }; };
Constructor Summary | |
StateMachine.State.Event(java.lang.String e)
Constructs a transition on a position with no modifier that loops on the current state. |
|
StateMachine.State.Event(java.lang.String e,
int m)
Constructs a transition. |
|
StateMachine.State.Event(java.lang.String e,
int m,
java.lang.String a)
Constructs a transition. |
|
StateMachine.State.Event(java.lang.String e,
java.lang.String a)
Constructs a transition with no modifier. |
Method Summary | |
java.lang.String |
hashKey()
Returns the hashkey of this transition. |
Methods inherited from class sm.StateMachine.State.Transition |
action, getModifier, getOutputStateName, getVirtualEvent, guard, oldToString, setVirtualEvent, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StateMachine.State.Event(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" 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.Event(java.lang.String e, int m)
e
- The string describing the events for which this transition must be triggered: "Down", "Motion", "Move", "Up", "Click" or "Gesture"*m
- The modifier: NOMODIFIER, CONTROL, ALT, SHIFT, ALT_CONTROL, CONTROL_SHIFT, ALT_SHIFT or ALT_CONTROL_SHIFTpublic StateMachine.State.Event(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" or "Gesture"*a
- The name of the output statepublic StateMachine.State.Event(java.lang.String e)
e
- The string describing the events for which this transition must be triggered: "Down", "Motion", "Move", "Up", "Click" or "Gesture"*Method Detail |
public java.lang.String hashKey()
StateMachine.State.Transition
hashKey
in class StateMachine.State.Transition
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |