Package | com.eqsim.FStEng |
Class | public class HStateC |
Inheritance | HStateC ![]() ![]() |
Subclasses | HState |
A hierarchical state with concurrency is a state that has multiple sub-networks of states, each operating in parallel. Each sub-network has a State Manager to keep track of the current and last states for that sub-network. Most of the time, engines will use HState's, which are hierarchical states with a single sub-network of states. From an implementation point of view, however, HState's are specializations of HStateC's, namely a hierarchical state with concurrency but only a single sub-network (so no real concurrency, then).
See also
Property | Defined By | ||
---|---|---|---|
![]() | handledEvYet : Boolean
Boolean flag used to determine if the State has handled the current event. | State | |
![]() | id : String
String identifier for the state. | State | |
![]() | myStMgr : StateManager
Pointer to this State's State Manager instance. | State | |
![]() | name : String
An optional name for the State to give to the State Manager, used for display purposes only. | State | |
numStMgrs : uint
Number of state managers (i.e., sub-networks) within this state. | HStateC | ||
![]() | pulseActivities : Array
An array containing the pulse activities (PulseActivity) for this state. | State | |
![]() | _se : StateEngine
Pointer to the State Engine instance. | State | |
stMgrs : Object
An object that holds a hash table (indexed by State Manager id's) to the State Managers for this state. | HStateC | ||
substates : Object
Collection of children states. | HStateC | ||
![]() | transitions : Object
An Object, keyed by target state id, that contains all the transitions for this State. | State |
Method | Defined By | ||
---|---|---|---|
HStateC(identifier:*, msm:StateManager = null, nm:String = null)
Create a new hierarchical state with more than one sub-network. | HStateC | ||
![]() | addPulseActivity(intvl:uint, cb:Function, fb:Boolean = false):PulseActivity
Use this method to add an activity to the state that fires at a specified interval. | State | |
addStateManager(sm:StateManager):void
Adds the specified state manager (StateManager) to this state. | HStateC | ||
Given an identifier, create a new sub-state that is a hierarchical state (HState). | HStateC | ||
Given an identifier, create a new sub-state that is a concurrent, hierarchical state (HStateC). | HStateC | ||
Given an identifier, create a new sub-state that is a simple state (State). | HStateC | ||
![]() | addTransitionExternal(tEvtName:String, targetStateID:String, transFn:Function = null, ulfxt:uint = 1):Transition
Add an 'external' transition, i.e., from this State to a target state. | State | |
![]() | addTransitionToHistory(tEvtName:String, targetStateID:String, transFn:Function = null):Transition
Add a transition from the current state to the history pseudo-state of a state. | State | |
![]() | addTransitionToSelf(tEvtName:String, transFn:Function = null, ulfst:int = 0):Transition
Add a transition from this State to itself, specifying parents to exit and re-enter. | State | |
![]() | addTransitionToTarget(tEvtName:String, targetStateID:String, transFn:Function = null):Transition
Add a transition from this State to a target state other than history. | State | |
![]() | chgSt(trans:Transition, val:* = null):void
Change state using transition trans_i, with an optional value for the
transition function as a second argument. | State | |
![]() | enter(hist:Boolean = false, specIDs:Array = null):void
Called when a state is entered. | State | |
![]() | isActive():Boolean
convenience function. | State | |
isSubstate(st:State):Boolean [override]
isSubstate allows the caller to ask if a state is a substate of the state being called. | HStateC | ||
![]() | leave():void
Called when the state is exited (deactivated). | State | |
![]() | onEvent(ev:Event, handledYet:Boolean):Boolean
This is a new feature of FStEng v1.5, which provides an easy way to direct and process
events. | State | |
![]() | registerSubStates(stateEng:StateEngine):void
Goes through substates to register them with the state engine. | State | |
![]() | removePulseActivity(pa:PulseActivity):void
Removes the specified pulse activity from the state. | State | |
removeState():void [override]
Deletes memory associated with this state. | HStateC | ||
![]() | removeTransition(trans:Transition):void
Remove the given transition from this State. | State | |
![]() | resetHistory():void | State | |
setDefaultStartState(id:String, mgr:StateManager = null):void
Allows the developer to specify the default start state for a given sub-network. | HStateC |
numStMgrs | property |
public var numStMgrs:uint
Number of state managers (i.e., sub-networks) within this state.
stMgrs | property |
public var stMgrs:Object
An object that holds a hash table (indexed by State Manager id's) to the State Managers for this state.
substates | property |
public var substates:Object
Collection of children states. An object that holds a hash table (indexed by state id's) to the children of this state. Grandchildren (if there are any) are stored in the children's states, not here.
HStateC | () | Constructor |
public function HStateC(identifier:*, msm:StateManager = null, nm:String = null)
Create a new hierarchical state with more than one sub-network.
The State Manager distinguishes states it controls via unique state identifiers (for that network). The identifer must be unique among all states in the State Engine.
When you create an HStateC or an HState, you must also create state managers (StateManager). When you create a StateManager, you specify the hierarchical state which it manages. Therefore, for HStateC's, you will create several StateManager's and hook them up to the same (container) state. For HState's, you will only need to create one (1) StateManager.
Parametersidentifier:* — State identifier (id). Must be unique among all states in the state engine.
| |
msm:StateManager (default = null ) — Pointer to the StateManager in the network that this HStateC belongs. Pass in the parent
state, not the StateManager that will control this state's sub-network.
| |
nm:String (default = null ) — Display name of the State. If null (not supplied), routines use the id for the display name.
|
addStateManager | () | method |
public function addStateManager(sm:StateManager):void
Adds the specified state manager (StateManager) to this state.
The State Manager keeps track of the active state within a sub-network. Once you have created a new instance of a StateManager, you pass that instance pointer into this routine. State manager id's must be unique among sibling managers. By convention, state manager id's are alphabetic, though in this implementation, we make identifiers as Strings.
Parameters
sm:StateManager |
addSubHState | () | method |
public function addSubHState(sid:String, mgr:StateManager = null, name:String = null):HState
Given an identifier, create a new sub-state that is a hierarchical state (HState).
If a manager has already been declared, use it. Otherwise, create a new manager. If we create a new manager,
the developer must use setDefaultStartState
to initialize the default start state.
Parameters
sid:String — state identifier for the sub-state
| |
mgr:StateManager (default = null ) — Manager for the sub-state's network. We set it as optional so HState users don't need to provide it, but for sub-networks of HStateC's, it is required.
| |
name:String (default = null ) — Optional display name for the state. If not provided, we use the state id.
|
HState |
addSubHStateC | () | method |
public function addSubHStateC(sid:String, mgr:StateManager = null, name:String = null):HStateC
Given an identifier, create a new sub-state that is a concurrent, hierarchical state (HStateC).
If a manager has already been declared, use it. Otherwise, create a new manager. If we create a new manager,
the developer must use setDefaultStartState
to initialize the default start state.
Parameters
sid:String — state identifier for the sub-state
| |
mgr:StateManager (default = null ) — Manager for the sub-state's network. We set it as optional so HState users don't need to provide it, but for sub-networks of HStateC's, it is required.
| |
name:String (default = null ) — Optional display name for the state. If not provided, we use the state id.
|
HStateC |
addSubState | () | method |
public function addSubState(sid:String, mgr:StateManager = null, name:String = null):State
Given an identifier, create a new sub-state that is a simple state (State).
If a manager has already been declared, use it. Otherwise, create a new manager. If we create a new manager,
the developer must use setDefaultStartState
to initialize the default start state.
Parameters
sid:String — state identifier for the sub-state
| |
mgr:StateManager (default = null ) — Manager for the sub-state's network. We set it as optional so HState users don't need to provide it, but for sub-networks of HStateC's, it is required.
| |
name:String (default = null ) — Optional display name for the state. If not provided, we use the state id.
|
State |
isSubstate | () | method |
override public function isSubstate(st:State):Boolean
isSubstate allows the caller to ask if a state is a substate of the state being called. It returns true if it is a substate, false if it is not.
Parameters
st:State |
Boolean |
removeState | () | method |
override public function removeState():void
Deletes memory associated with this state.
setDefaultStartState | () | method |
public function setDefaultStartState(id:String, mgr:StateManager = null):void
Allows the developer to specify the default start state for a given sub-network.
The default start state is specified in the State Manager. This routine lets the developer specify the start state for this manager. The same can be done in the StateManager constructor, but this may be a more convenient way to do it.
Ordinarily, we could retrieve the manager from the state id alone, but the developer may not have created the state yet.
Parameters
id:String — String identifier for the state
| |
mgr:StateManager (default = null ) — Parameter specifying the manager of the sub-state. It is declared as optional so that HState (a child class) does not have to require the manager. For HStateC's, you need to specify which manager is managing the state to make default start.
|