Package com.tangosol.util.fsm
Class SimpleModel<S extends Enum<S>>
java.lang.Object
com.tangosol.util.fsm.SimpleModel<S>
- Type Parameters:
S
- the type of state
- All Implemented Interfaces:
Model<S>
- Author:
- Brian Oliver
-
Constructor Summary
ConstructorDescriptionSimpleModel
(Class<S> stateClass) Constructs aSimpleModel
given an Enum of the possible states of aFiniteStateMachine
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
.Obtains the state with the specified name from theSimpleModel
.Obtains theStateEntryAction
s defined for the states in theModel
.Map
<S, StateExitAction<S>> Obtains theStateExitAction
s defined for the states in theModel
.S[]
Obtains the valid states defined by theModel
.Obtains theTransition
s defined by theModel
.
-
Constructor Details
-
SimpleModel
Constructs aSimpleModel
given an Enum of the possible states of aFiniteStateMachine
.- Parameters:
stateClass
- the Enum class containing the possible states
-
-
Method Details
-
getStateClass
-
getStates
Obtains the valid states defined by theModel
. -
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
Adds/overrides theStateEntryAction
for the specified state in theModel
.- Parameters:
state
- the statestateEntryAction
- theStateEntryAction
for the state
-
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
Obtains theTransition
s defined by theModel
.- Specified by:
getTransitions
in interfaceModel<S extends Enum<S>>
- Returns:
- the
Transition
s defined by theModel
-
getState
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
Adds/overrides theStateExitAction
for the specified state in theModel
.- Parameters:
state
- the statestateExitAction
- theStateExitAction
for the state
-
addTransition
Adds the specifiedTransition
to theModel
.- Parameters:
transition
- theTransition
to add
-