Package com.tangosol.util.fsm
Class SimpleModel<S extends Enum<S>>
- java.lang.Object
-
- com.tangosol.util.fsm.SimpleModel<S>
-
-
Constructor Summary
Constructors Constructor Description SimpleModel(Class<S> stateClass)Constructs aSimpleModelgiven an Enum of the possible states of aFiniteStateMachine.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddStateEntryAction(S state, StateEntryAction<S> stateEntryAction)Adds/overrides theStateEntryActionfor the specified state in theModel.voidaddStateExitAction(S state, StateExitAction<S> stateExitAction)Adds/overrides theStateExitActionfor the specified state in theModel.voidaddTransition(Transition<S> transition)Adds the specifiedTransitionto theModel.SgetState(String sName)Obtains the state with the specified name from theSimpleModel.Class<S>getStateClass()Map<S,StateEntryAction<S>>getStateEntryActions()Obtains theStateEntryActions defined for the states in theModel.Map<S,StateExitAction<S>>getStateExitActions()Obtains theStateExitActions defined for the states in theModel.S[]getStates()Obtains the valid states defined by theModel.Iterable<Transition<S>>getTransitions()Obtains theTransitions defined by theModel.
-
-
-
Constructor Detail
-
SimpleModel
public SimpleModel(Class<S> stateClass)
Constructs aSimpleModelgiven an Enum of the possible states of aFiniteStateMachine.- Parameters:
stateClass- the Enum class containing the possible states
-
-
Method Detail
-
getStateEntryActions
public Map<S,StateEntryAction<S>> getStateEntryActions()
Obtains theStateEntryActions defined for the states in theModel.- Specified by:
getStateEntryActionsin interfaceModel<S extends Enum<S>>- Returns:
- the defined
StateEntryActions defined for the states in theModel
-
addStateEntryAction
public void addStateEntryAction(S state, StateEntryAction<S> stateEntryAction)
Adds/overrides theStateEntryActionfor the specified state in theModel.- Parameters:
state- the statestateEntryAction- theStateEntryActionfor the state
-
getStateExitActions
public Map<S,StateExitAction<S>> getStateExitActions()
Obtains theStateExitActions defined for the states in theModel.- Specified by:
getStateExitActionsin interfaceModel<S extends Enum<S>>- Returns:
- the defined
StateExitActions defined for the states in theModel
-
getTransitions
public Iterable<Transition<S>> getTransitions()
Obtains theTransitions defined by theModel.- Specified by:
getTransitionsin interfaceModel<S extends Enum<S>>- Returns:
- the
Transitions defined by theModel
-
getState
public S getState(String sName)
Obtains the state with the specified name from theSimpleModel.- Parameters:
sName- the name of the state to obtain- Returns:
- the state with the specified name or
nullif no such state is known by theSimpleModel
-
addStateExitAction
public void addStateExitAction(S state, StateExitAction<S> stateExitAction)
Adds/overrides theStateExitActionfor the specified state in theModel.- Parameters:
state- the statestateExitAction- theStateExitActionfor the state
-
addTransition
public void addTransition(Transition<S> transition)
Adds the specifiedTransitionto theModel.- Parameters:
transition- theTransitionto add
-
-