sm
Class SMStateMachineEvent

java.lang.Object
  extended byjava.util.EventObject
      extended bysm.SMStateMachineEvent
All Implemented Interfaces:
java.io.Serializable

public class SMStateMachineEvent
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 SMStateMachineEvent object is fired to every SMStateMachineEventListener or SMStateMachineEventAdapter object which is registered to receive the "interesting" mouse events using the state machine's addSMListener method. (SMStateMachineEventAdapter objects implement the SMStateMachineEventListener interface.) Each such listener object gets a SMStateMachineEvent containing the state machine event.

The current state and current canvas attached to this state machine can be retrieved using SMStateMachineEvent.getCurrentState() and SMStateMachineEvent.getCurrentState().

The getPreviousState() and getTransition() retrieve the previous state and the transition when the event is due to the passage of a transition in the state machine. For every other events (attached to an interactive object, detached from an interactive object, etc.), those methods return null.

Author:
Caroline Appert
See Also:
Serialized Form

Constructor Summary
SMStateMachineEvent(java.lang.Object stateMachine, StateMachine.State.Transition t, StateMachine.State previousState, StateMachine.State currentState, InteractiveObject io)
          Builds a SMStateMachineEvent.
SMStateMachineEvent(StateMachine stateMachine)
          Builds a SMStateMachineEvent originated by a state machine that has just been inited.
SMStateMachineEvent(StateMachine stateMachine, InteractiveObject io)
          Builds a SMStateMachineEvent originated by a state machine that has just been inited.
SMStateMachineEvent(StateMachine stateMachine, StateMachine.State.Transition t, StateMachine.State cState, InteractiveObject io)
          Builds a SMStateMachineEvent originated by a state machine that has just fired a transition that makes it loop on the current state.
SMStateMachineEvent(StateMachine stateMachine, StateMachine.State.Transition t, StateMachine.State pState, StateMachine.State cState)
          Builds a SMStateMachineEvent.
 
Method Summary
 StateMachine.State getCurrentState()
          Returns the current state of the state machine that originated this SMStateMachineEvent.
 StateMachine.State getPreviousState()
          Returns the previous state of the state machine that originated this SMStateMachineEvent.
 StateMachine getSmSource()
          Returns the state machine that originated this event.
 StateMachine.State.Transition getTransition()
          Returns the transition that has just been fired by this state machine.
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SMStateMachineEvent

public SMStateMachineEvent(StateMachine stateMachine,
                           StateMachine.State.Transition t,
                           StateMachine.State pState,
                           StateMachine.State cState)
Builds a SMStateMachineEvent.

Parameters:
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.

SMStateMachineEvent

public SMStateMachineEvent(StateMachine stateMachine,
                           StateMachine.State.Transition t,
                           StateMachine.State cState,
                           InteractiveObject io)
Builds a SMStateMachineEvent originated by a state machine that has just fired a transition that makes it loop on the current state. The previousState field is equal to the currentState field.

Parameters:
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.
io - The interactive object that has originated this event.

SMStateMachineEvent

public SMStateMachineEvent(StateMachine stateMachine)
Builds a SMStateMachineEvent originated by a state machine that has just been inited.

Parameters:
stateMachine - The state machine that originated this event.

SMStateMachineEvent

public SMStateMachineEvent(StateMachine stateMachine,
                           InteractiveObject io)
Builds a SMStateMachineEvent originated by a state machine that has just been inited.

Parameters:
stateMachine - The state machine that originated this event.
io - The interactive object that has originated a transition

SMStateMachineEvent

public SMStateMachineEvent(java.lang.Object stateMachine,
                           StateMachine.State.Transition t,
                           StateMachine.State previousState,
                           StateMachine.State currentState,
                           InteractiveObject io)
Builds a SMStateMachineEvent.

Parameters:
stateMachine - The state machine that has originated a transition.
t - The transition of the state machine that has just been fired.
previousState - The state of the state machine before t has been fired.
currentState - The current state of the state machine.
io - The interactive object that has originated a transition.
Method Detail

getCurrentState

public StateMachine.State getCurrentState()
Returns the current state of the state machine that originated this SMStateMachineEvent.

Returns:
Returns the current state of the state machine that originated this SMStateMachineEvent.

getPreviousState

public StateMachine.State getPreviousState()
Returns the previous state of the state machine that originated this SMStateMachineEvent.

Returns:
Returns the previous state of the state machine that originated this SMStateMachineEvent. null when this SMStateMachineEvent has been originated by a state machine when it has been attached to an interactive object, detached from an interactive object, resumed, reset or suspended.

getTransition

public StateMachine.State.Transition getTransition()
Returns the transition that has just been fired by this state machine.

Returns:
Returns the transition that has just been fired by this state machine. The state machine originated this event because this transition has been fired. null when this SMStateMachineEvent has been originated by a state machine when it has been attached to a canvas, detached from a canvas, resumed, reset or suspended.

getSmSource

public StateMachine getSmSource()
Returns the state machine that originated this event.

Returns:
Returns the state machine that originated this event.

toString

public java.lang.String toString()