fr.lri.swingstates.debug
Class Watcher

java.lang.Object
  extended by fr.lri.swingstates.debug.Watcher

public class Watcher
extends java.lang.Object

A 'watcher' to track a state machine. It registers listeners for StateMachineEvents, i.e. when the state machine:

Author:
Caroline Appert

Constructor Summary
Watcher(StateMachine stateMachine)
          Builds a 'watcher' for a state machine.
 
Method Summary
 void addSMEventListener(StateMachineEventListener l)
          Registers a listener for StateMachineEvents.
 void fireSMInited()
          Fires a StateMachineEvent to all registered listeners notifying them the state machine has just been inited.
 void fireSmReset(State previousState)
          Fires a StateMachineEvent to all registered listeners notifying them the state machine has been restarted.
 void fireSmResumed()
          Fires a StateMachineEvent to all registered listeners notifying them the state machine has been resumed.
 void fireSmSuspended()
          Fires a StateMachineEvent to all registered listeners notifying them the state machine has been suspended.
 void fireStateChanged(Transition t, State previousState, State currentState)
          Fires a StateMachineEvent to all registered listeners notifying them the state machine has passed in another state.
 void fireStateLooped(Transition t, State state)
          Fires a StateMachineEvent to all registered listeners notifying them the state machine has passed a transition but looped in its current state.
 void removeSMEventListener(StateMachineEventListener l)
          Removes a listener for SMEvents.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Watcher

public Watcher(StateMachine stateMachine)
Builds a 'watcher' for a state machine.

Parameters:
stateMachine - The state machine to watch.
Method Detail

addSMEventListener

public void addSMEventListener(StateMachineEventListener l)
Registers a listener for StateMachineEvents.

Parameters:
l - The listener to register.

removeSMEventListener

public void removeSMEventListener(StateMachineEventListener l)
Removes a listener for SMEvents.

Parameters:
l - The listener to remove.

fireSmSuspended

public void fireSmSuspended()
Fires a StateMachineEvent to all registered listeners notifying them the state machine has been suspended.


fireSmResumed

public void fireSmResumed()
Fires a StateMachineEvent to all registered listeners notifying them the state machine has been resumed.


fireSmReset

public void fireSmReset(State previousState)
Fires a StateMachineEvent to all registered listeners notifying them the state machine has been restarted.

Parameters:
previousState - The active state before this machine being reset

fireStateChanged

public void fireStateChanged(Transition t,
                             State previousState,
                             State currentState)
Fires a StateMachineEvent to all registered listeners notifying them the state machine has passed in another state.

Parameters:
t - The transition that has just been fired.
previousState - The state before the transition.
currentState - The current state (after the transition).

fireStateLooped

public void fireStateLooped(Transition t,
                            State state)
Fires a StateMachineEvent to all registered listeners notifying them the state machine has passed a transition but looped in its current state.

Parameters:
t - The transition that has just been fired.
state - The current state.

fireSMInited

public void fireSMInited()
Fires a StateMachineEvent to all registered listeners notifying them the state machine has just been inited.