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 aSimpleModel
given an Enum of the possible states of aFiniteStateMachine
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStateEntryAction(S state, StateEntryAction<S> stateEntryAction)
Adds/overrides theStateEntryAction
for the specified state in theModel
.void
addStateExitAction(S state, StateExitAction<S> stateExitAction)
Adds/overrides theStateExitAction
for the specified state in theModel
.void
addTransition(Transition<S> transition)
Adds the specifiedTransition
to theModel
.S
getState(String sName)
Obtains the state with the specified name from theSimpleModel
.Class<S>
getStateClass()
Map<S,StateEntryAction<S>>
getStateEntryActions()
Obtains theStateEntryAction
s defined for the states in theModel
.Map<S,StateExitAction<S>>
getStateExitActions()
Obtains theStateExitAction
s defined for the states in theModel
.S[]
getStates()
Obtains the valid states defined by theModel
.Iterable<Transition<S>>
getTransitions()
Obtains theTransition
s defined by theModel
.
-
-
-
Constructor Detail
-
SimpleModel
public SimpleModel(Class<S> stateClass)
Constructs aSimpleModel
given 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 theStateEntryAction
s defined for the states in theModel
.- Specified by:
getStateEntryActions
in interfaceModel<S extends Enum<S>>
- Returns:
- the defined
StateEntryAction
s defined for the states in theModel
-
addStateEntryAction
public void addStateEntryAction(S state, StateEntryAction<S> stateEntryAction)
Adds/overrides theStateEntryAction
for the specified state in theModel
.- Parameters:
state
- the statestateEntryAction
- theStateEntryAction
for the state
-
getStateExitActions
public Map<S,StateExitAction<S>> getStateExitActions()
Obtains theStateExitAction
s defined for the states in theModel
.- Specified by:
getStateExitActions
in interfaceModel<S extends Enum<S>>
- Returns:
- the defined
StateExitAction
s defined for the states in theModel
-
getTransitions
public Iterable<Transition<S>> getTransitions()
Obtains theTransition
s defined by theModel
.- Specified by:
getTransitions
in interfaceModel<S extends Enum<S>>
- Returns:
- the
Transition
s 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
null
if no such state is known by theSimpleModel
-
addStateExitAction
public void addStateExitAction(S state, StateExitAction<S> stateExitAction)
Adds/overrides theStateExitAction
for the specified state in theModel
.- Parameters:
state
- the statestateExitAction
- theStateExitAction
for the state
-
addTransition
public void addTransition(Transition<S> transition)
Adds the specifiedTransition
to theModel
.- Parameters:
transition
- theTransition
to add
-
-