Package repast.simphony.statecharts
Class DefaultStateChart<T>
java.lang.Object
repast.simphony.statecharts.DefaultStateChart<T>
- All Implemented Interfaces:
StateChart<T>
-
Field Summary
Modifier and TypeFieldDescriptionprotected List<Transition<T>>
protected List<Transition<T>>
protected SimpleState<T>
protected List<Transition<T>>
protected List<Transition<T>>
-
Constructor Summary
ModifierConstructorDescriptionprotected
DefaultStateChart
(T agent) Creates DefaultStateChart for the specified agent and sets whether or not the agent needs to be in a Context for the statechart to function. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activateState
(String stateID) Activates the state (identified by a potentially non-unique ID) if it exists.void
activateState
(AbstractState<T> state) Activates the state if it exists.protected void
addRegularTransition
(Transition<T> transition) protected void
addSelfTransition
(SelfTransition<T> transition) protected void
addState
(AbstractState<T> state) void
begin
(StateChartSimIntegrator integrator) Begin state chart.void
followTransition
(String transitionID) Follow the transition (identified by a potentially non-unique ID) if valid.void
followTransition
(Transition<T> transition) Follow the transition if valid.getAgent()
Gets the agent associated with this StateChart.Retrieve current state.protected Parameters
double
getQueue()
getStateForUuid
(String uuid) Returns the state associated with the uuid or null if not found.getTransitionForUuid
(String uuid) Returns the transition associated with the uuid or null if not found.protected TransitionResolutionStrategy
getUuidForState
(AbstractState<T> state) protected void
putStateUuid
(AbstractState<T> state, String uuid) protected void
putTransitionUuid
(Transition<T> transition, String uuid) void
receiveMessage
(Object message) Receive a message into the statechart queue.protected void
registerEntryState
(AbstractState<T> state) void
protected void
removeResolveTime
(double nextTime) void
void
resolve()
protected void
scheduleResolveTime
(double nextTime) protected void
setPriority
(double priority) protected void
setStateUuidMap
(Map<AbstractState<T>, String> stateUuidMap) protected void
setTransitionResolutionStrategy
(TransitionResolutionStrategy transitionResolutionStrategy) protected void
setTransitionUuidMap
(Map<Transition<T>, String> transitionUuidMap) void
stop()
Stops this statechart.boolean
withinState
(String id)
-
Field Details
-
regularTransitions
-
activeRegularTransitions
-
selfTransitions
-
activeSelfTransitions
-
currentSimpleState
-
-
Constructor Details
-
DefaultStateChart
Creates DefaultStateChart for the specified agent and sets whether or not the agent needs to be in a Context for the statechart to function.- Parameters:
agent
-contextRequired
-
-
-
Method Details
-
getTransitionResolutionStrategy
-
setTransitionResolutionStrategy
protected void setTransitionResolutionStrategy(TransitionResolutionStrategy transitionResolutionStrategy) -
setStateUuidMap
-
putStateUuid
-
setTransitionUuidMap
-
putTransitionUuid
-
registerEntryState
-
begin
Description copied from interface:StateChart
Begin state chart.- Specified by:
begin
in interfaceStateChart<T>
-
stop
public void stop()Stops this statechart.- Specified by:
stop
in interfaceStateChart<T>
-
addState
-
addRegularTransition
-
addSelfTransition
-
getCurrentSimpleState
Description copied from interface:StateChart
Retrieve current state.- Specified by:
getCurrentSimpleState
in interfaceStateChart<T>
- Returns:
-
resolve
public void resolve()- Specified by:
resolve
in interfaceStateChart<T>
-
scheduleResolveTime
protected void scheduleResolveTime(double nextTime) -
removeResolveTime
protected void removeResolveTime(double nextTime) -
getQueue
-
receiveMessage
Description copied from interface:StateChart
Receive a message into the statechart queue.- Specified by:
receiveMessage
in interfaceStateChart<T>
-
getPriority
public double getPriority()- Specified by:
getPriority
in interfaceStateChart<T>
-
setPriority
protected void setPriority(double priority) -
getAgent
Description copied from interface:StateChart
Gets the agent associated with this StateChart.- Specified by:
getAgent
in interfaceStateChart<T>
- Returns:
- the agent associated with this StateChart.
-
getParams
-
withinState
- Specified by:
withinState
in interfaceStateChart<T>
-
getCurrentStates
- Specified by:
getCurrentStates
in interfaceStateChart<T>
-
getUuidForState
- Specified by:
getUuidForState
in interfaceStateChart<T>
-
getStateForUuid
Description copied from interface:StateChart
Returns the state associated with the uuid or null if not found.- Specified by:
getStateForUuid
in interfaceStateChart<T>
- Returns:
-
getTransitionForUuid
Description copied from interface:StateChart
Returns the transition associated with the uuid or null if not found.- Specified by:
getTransitionForUuid
in interfaceStateChart<T>
- Returns:
-
registerStateChartListener
- Specified by:
registerStateChartListener
in interfaceStateChart<T>
-
removeStateChartListener
- Specified by:
removeStateChartListener
in interfaceStateChart<T>
-
activateState
Description copied from interface:StateChart
Activates the state if it exists. Should be called when simulation is paused.- Specified by:
activateState
in interfaceStateChart<T>
- Parameters:
state
- the state to activate
-
activateState
Description copied from interface:StateChart
Activates the state (identified by a potentially non-unique ID) if it exists.- Specified by:
activateState
in interfaceStateChart<T>
- Parameters:
stateID
- the potentially non-unique ID of the state to activate
-
followTransition
Description copied from interface:StateChart
Follow the transition (identified by a potentially non-unique ID) if valid.- Specified by:
followTransition
in interfaceStateChart<T>
- Parameters:
transitionID
- the potentially non-unique ID of the transition to follow
-
followTransition
Description copied from interface:StateChart
Follow the transition if valid. Should be called when simulation is paused.- Specified by:
followTransition
in interfaceStateChart<T>
- Parameters:
transition
- the transition to follow
-