net.sf.jzeno.model
Class AbstractStateManager

java.lang.Object
  extended by net.sf.jzeno.model.AbstractStateManager
All Implemented Interfaces:
StateManager

public abstract class AbstractStateManager
extends java.lang.Object
implements StateManager


Constructor Summary
protected AbstractStateManager()
           
 
Method Summary
protected  void addState(java.lang.Object sourceState, java.lang.Object[] targetStates)
           This operation is used to add a state to the state manager.
 java.util.List getAllowedTargetStates(java.lang.Object oldStatus)
           Return a list of allowed target states for the given source state.
protected abstract  void initialize()
           Operation that initializes the states and state transitions; Must be implemented by subclasses.
 boolean isAllowedTransition(java.lang.Object oldStatus, java.lang.Object newStatus)
           This operation checks wether or not a certain state transition is allowed.
 boolean isEnabled()
           
 void setEnabled(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jzeno.model.StateManager
getStateClass, getStatePropertyName
 

Constructor Detail

AbstractStateManager

protected AbstractStateManager()
Method Detail

initialize

protected abstract void initialize()

Operation that initializes the states and state transitions; Must be implemented by subclasses.


addState

protected void addState(java.lang.Object sourceState,
                        java.lang.Object[] targetStates)

This operation is used to add a state to the state manager. You have to specify the state object as source state, and all possible target states that can be reached from this source state. That way you specify the entire state transition diagram. The START state should be registered as sourceState == null. END states should be registered by adding null to the possible target states. States that are final, but don't allow deletion should be entered added with an empty list of target states.


getAllowedTargetStates

public java.util.List getAllowedTargetStates(java.lang.Object oldStatus)

Return a list of allowed target states for the given source state.

Specified by:
getAllowedTargetStates in interface StateManager

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface StateManager

setEnabled

public void setEnabled(boolean b)
Specified by:
setEnabled in interface StateManager

isAllowedTransition

public boolean isAllowedTransition(java.lang.Object oldStatus,
                                   java.lang.Object newStatus)

This operation checks wether or not a certain state transition is allowed.

Specified by:
isAllowedTransition in interface StateManager