Packagecom.eqsim.FStEng
Classpublic class HStateC
InheritanceHStateC Inheritance State Inheritance flash.events.EventDispatcher
Subclasses HState

A hierarchical state with concurrency.

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

StateEngine definition examples.


Public Properties
 PropertyDefined By
 InheritedhandledEvYet : Boolean
Boolean flag used to determine if the State has handled the current event.
State
 Inheritedid : String
String identifier for the state.
State
 InheritedmyStMgr : StateManager
Pointer to this State's State Manager instance.
State
 Inheritedname : 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
 InheritedpulseActivities : Array
An array containing the pulse activities (PulseActivity) for this state.
State
 Inherited_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
 Inheritedtransitions : Object
An Object, keyed by target state id, that contains all the transitions for this State.
State
Public Methods
 MethodDefined By
  
HStateC(identifier:*, msm:StateManager = null, nm:String = null)
Create a new hierarchical state with more than one sub-network.
HStateC
 Inherited
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
  
Adds the specified state manager (StateManager) to this state.
HStateC
  
addSubHState(sid:String, mgr:StateManager = null, name:String = null):HState
Given an identifier, create a new sub-state that is a hierarchical state (HState).
HStateC
  
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).
HStateC
  
addSubState(sid:String, mgr:StateManager = null, name:String = null):State
Given an identifier, create a new sub-state that is a simple state (State).
HStateC
 Inherited
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
 Inherited
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
 Inherited
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
 Inherited
addTransitionToTarget(tEvtName:String, targetStateID:String, transFn:Function = null):Transition
Add a transition from this State to a target state other than history.
State
 Inherited
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
 Inherited
enter(hist:Boolean = false, specIDs:Array = null):void
Called when a state is entered.
State
 Inherited
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
 Inherited
leave():void
Called when the state is exited (deactivated).
State
 Inherited
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
 Inherited
Goes through substates to register them with the state engine.
State
 Inherited
Removes the specified pulse activity from the state.
State
  
[override] Deletes memory associated with this state.
HStateC
 Inherited
Remove the given transition from this State.
State
 Inherited
State
  
setDefaultStartState(id:String, mgr:StateManager = null):void
Allows the developer to specify the default start state for a given sub-network.
HStateC
Public Constants
 ConstantDefined By
 InheritedENTRY : String = ENTRY
[static] Event generated on entry to a state.
State
 InheritedLEAVE : String = LEAVE
[static] Event generated when the state is no longer active.
State
Property Detail
numStMgrsproperty
public var numStMgrs:uint

Number of state managers (i.e., sub-networks) within this state.

stMgrsproperty 
public var stMgrs:Object

An object that holds a hash table (indexed by State Manager id's) to the State Managers for this state.

substatesproperty 
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.

Constructor Detail
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.

Parameters
identifier:* — 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.
Method Detail
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.

Returns
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.

Returns
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.

Returns
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

Returns
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.