public class VirtualEvent
extends java.util.EventObject
For instance, to send a virtual event "copy" to a state machine sm
:
//Build a virtual event VirtualEvent copyEvent = new VirtualEvent("copy"); //Send it to a state machine sm sm.processEvent(copyEvent);The virtual event can thus be used to fire a transition in sm:
StateMachine sm = new StateMachine() { public State s = new State () { Transition t = new Transition("copy") { ... }; ... }; ... };
Constructor and Description |
---|
VirtualEvent(java.lang.String n)
Builds a virtual event.
|
VirtualEvent(java.lang.String n,
java.lang.Object source)
Builds a virtual event.
|
Modifier and Type | Method and Description |
---|---|
java.util.LinkedList<Transition> |
getMatchingTransitions(State state)
Retrieves the transitions that match the name of this event on a given state.
|
java.lang.String |
getNameEvent()
Returns the name of the virtual event.
|
void |
setNameEvent(java.lang.String n)
Sets the name of a virtual event.
|
void |
setSource(java.lang.Object source)
Sets the source of this
VirtualEvent . |
public VirtualEvent(java.lang.String n)
n
- The name of the virtual event.public VirtualEvent(java.lang.String n, java.lang.Object source)
n
- The name of the virtual event.public java.lang.String getNameEvent()
public void setNameEvent(java.lang.String n)
n
- The name of the virtual event to set.public java.util.LinkedList<Transition> getMatchingTransitions(State state)
state
- The state.public void setSource(java.lang.Object source)
VirtualEvent
.source
- The new source.