public class StateMachineEvent
extends java.util.EventObject
An event which indicates that an action occurred in a state machine. This event is used both for the following state machine events:
A StateMachineEvent object is fired to every StateMachineEventListener or StateMachineEventAdapter object which is registered to receive the "interesting" mouse events using the state machine's addSMListener method. (StateMachineEventAdapter objects implement the StateMachineEventListener interface.) Each such listener object gets a StateMachineEvent containing the state machine event.
The current state of this state machine can be retrieved using StateMachineEvent.getCurrentState()
.
The getPreviousState()
and getTransition()
retrieve the previous state and the transition.
Constructor and Description |
---|
StateMachineEvent(StateMachine stateMachine)
Builds a StateMachineEvent originated by a state machine that has just been inited.
|
StateMachineEvent(StateMachine stateMachine,
Transition t,
State cState)
Builds a StateMachineEvent originated by a state machine that has just fired a transition that makes it loop on the current state.
|
StateMachineEvent(StateMachine stateMachine,
Transition t,
State pState,
State cState)
Builds a StateMachineEvent.
|
Modifier and Type | Method and Description |
---|---|
State |
getCurrentState()
Returns the current state of the state machine that originated this StateMachineEvent.
|
State |
getPreviousState()
Returns the previous state of the state machine that originated this StateMachineEvent.
|
StateMachine |
getSmSource()
Returns the state machine that originated this event.
|
Transition |
getTransition()
Returns the transition that has just been fired by this state machine.
|
java.lang.String |
toString() |
public StateMachineEvent(StateMachine stateMachine, Transition t, State pState, State cState)
stateMachine
- The state machine that originated this event.t
- The transition of the state machine that has just been fired.pState
- The state of the state machine before t has been fired.cState
- The current state of the state machine.public StateMachineEvent(StateMachine stateMachine, Transition t, State cState)
previousState
field is equal to the currentState
field.stateMachine
- The state machine that originated this event.t
- The transition of the state machine that has just been fired.cState
- The current state of the state machine.public StateMachineEvent(StateMachine stateMachine)
stateMachine
- The state machine that originated this event.public State getCurrentState()
public State getPreviousState()
null
when this StateMachineEvent has been originated by a state machine when it
has been attached to a SMControlAttachable object, detached from a SMControlAttachable object, resumed, reset or suspended.public Transition getTransition()
null
when this StateMachineEvent has been originated by a state machine when it has been attached to a canvas, detached from a canvas, resumed, reset or suspended.public StateMachine getSmSource()
public java.lang.String toString()
toString
in class java.util.EventObject