Packageweavejs.path
Classpublic class WeavePath
InheritanceWeavePath Inheritance Object
Subclasses WeavePathData



Public Properties
 PropertyDefined By
  weave : Weave
A pointer to the Weave instance.
WeavePath
Protected Properties
 PropertyDefined By
  _parent : WeavePath
WeavePath
  _path : Array
WeavePath
Public Methods
 MethodDefined By
  
WeavePath(weave:Weave, basePath:Array)
WeavePath constructor.
WeavePath
  
addCallback(relevantContext:Object, callback:Function, triggerCallbackNow:Boolean = false, immediateMode:Boolean = false, delayWhileBusy:Boolean = true):WeavePath
Adds a callback to the object at the current path.
WeavePath
  
call(func:Function, ... args):WeavePath
Calls a function using the current WeavePath object as the 'this' value.
WeavePath
  
diff(... relativePath_diff):WeavePath
Applies a session state diff to the object at the current path or relative to the current path.
WeavePath
  
exec(script_or_function:*, callback:Function = null):WeavePath
Evaluates an ActionScript expression using the current path, vars, and libs.
WeavePath
  
forEach(items:Object, visitorFunction:Function):WeavePath
Applies a function to each item in an Array or an Object.
WeavePath
  
forEachChild(... relativePath_visitorFunction):WeavePath
Calls a function for each child of the current WeavePath or the one specified by a relativePath.
WeavePath
  
forEachName(... relativePath_visitorFunction):WeavePath
Calls a function for each child of the current WeavePath or the one specified by a relativePath.
WeavePath
  
getChildren(... relativePath):Array
Gets an Array of child WeavePath objects under the object at the current path or relative to the current path.
WeavePath
  
getDiff(... relativePath_previousState):Object
Gets the changes that have occurred since previousState for the object at the current path or relative to the current path.
WeavePath
  
getNames(... relativePath):Array
Gets an Array of child names under the object at the current path or relative to the current path.
WeavePath
  
getObject(... relativePath):ILinkableObject
WeavePath
  
getPath(... relativePath):Array
Returns a copy of the current path Array or the path Array of a descendant object.
WeavePath
  
getReverseDiff(... relativePath_otherState):Object
Gets the changes that would have to occur to get to another state for the object at the current path or relative to the current path.
WeavePath
  
getSimpleType(... relativePath):String
Gets the simple type (unqualified class name) of the object at the current path or relative to the current path.
WeavePath
  
getState(... relativePath):Object
Gets the session state of an object at the current path or relative to the current path.
WeavePath
  
getType(... relativePath):String
Gets the type (qualified class name) of the object at the current path or relative to the current path.
WeavePath
  
getTypedState(... relativePath):Object
WeavePath
  
getUntypedState(... relativePath):Object
WeavePath
  
getValue(script_or_function:*, ... args):Object
Returns the value of an ActionScript expression or variable using the current path as the 'this' argument.
WeavePath
  
migrate(source:WeavePath, destination:Weave):void
[static]
WeavePath
  
Returns to the previous WeavePath that spawned the current one with push().
WeavePath
  
push(... relativePath):WeavePath
Creates a new WeavePath relative to the current one.
WeavePath
  
remove(... relativePath):WeavePath
Removes a dynamically created object.
WeavePath
  
removeCallback(relevantContext:Object, callback:Function):WeavePath
Removes a callback from the object at the current path or from everywhere.
WeavePath
  
reorder(... orderedNames):WeavePath
Reorders the children of an ILinkableHashMap at the current path.
WeavePath
  
request(... relativePath_objectType):WeavePath
Requests that an object be created if it doesn't already exist at the current path (or relative path, if specified).
WeavePath
  
state(... relativePath_state):WeavePath
Sets the session state of the object at the current path or relative to the current path.
WeavePath
  
toString():String
Provides a human-readable string containing the path.
WeavePath
  
trace(... args):WeavePath
Calls weaveTrace() in Weave to print to the log window.
WeavePath
Protected Methods
 MethodDefined By
  
_assertParams(methodName:String, args:Array, minLength:int = 1):Boolean
[static]
WeavePath
  
_failMessage(methodName:String, message:String, path:Array = null):*
[static]
WeavePath
  
_failObject(methodName:String, path:Array):*
[static]
WeavePath
  
_failPath(methodName:String, path:Array):*
[static]
WeavePath
Property Detail
_parentproperty
protected var _parent:WeavePath

_pathproperty 
protected var _path:Array

weaveproperty 
public var weave:Weave

A pointer to the Weave instance.

Constructor Detail
WeavePath()Constructor
public function WeavePath(weave:Weave, basePath:Array)

WeavePath constructor. WeavePath objects are immutable after they are created.

Parameters
weave:Weave — An optional Array specifying the path to an object in the session state. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.
 
basePath:Array
Method Detail
_assertParams()method
protected static function _assertParams(methodName:String, args:Array, minLength:int = 1):Boolean

Parameters

methodName:String
 
args:Array
 
minLength:int (default = 1)

Returns
Boolean
_failMessage()method 
protected static function _failMessage(methodName:String, message:String, path:Array = null):*

Parameters

methodName:String
 
message:String
 
path:Array (default = null)

Returns
*
_failObject()method 
protected static function _failObject(methodName:String, path:Array):*

Parameters

methodName:String
 
path:Array

Returns
*
_failPath()method 
protected static function _failPath(methodName:String, path:Array):*

Parameters

methodName:String
 
path:Array

Returns
*
addCallback()method 
public function addCallback(relevantContext:Object, callback:Function, triggerCallbackNow:Boolean = false, immediateMode:Boolean = false, delayWhileBusy:Boolean = true):WeavePath

Adds a callback to the object at the current path. When the callback is called, a WeavePath object initialized at the current path will be used as the 'this' context. If the same callback is added to multiple paths, only the last path will be used as the 'this' context.

Parameters

relevantContext:Object — The thisArg for the function. When the context is disposed with Weave.dispose(), the callback will be disabled.
 
callback:Function — The callback function.
 
triggerCallbackNow:Boolean (default = false) — Optional parameter, when set to true will trigger the callback now.
 
immediateMode:Boolean (default = false) — Optional parameter, when set to true will use an immediate callback instead of a grouped callback.
 
delayWhileBusy:Boolean (default = true) — Optional parameter, specifies whether to delay a grouped callback while the object is busy. Default is true.

Returns
WeavePath — The current WeavePath object.
call()method 
public function call(func:Function, ... args):WeavePath

Calls a function using the current WeavePath object as the 'this' value.

Parameters

func:Function — The function to call.
 
... args — An optional list of arguments to pass to the function.

Returns
WeavePath — The current WeavePath object.
diff()method 
public function diff(... relativePath_diff):WeavePath

Applies a session state diff to the object at the current path or relative to the current path. Existing dynamically created objects that do not appear in the new state will remain unchanged.

Parameters

... relativePath_diff — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
WeavePath — The current WeavePath object.
exec()method 
public function exec(script_or_function:*, callback:Function = null):WeavePath

Evaluates an ActionScript expression using the current path, vars, and libs. The 'this' context within the script will be the object at the current path.

Parameters

script_or_function:* — Either a String containing JavaScript code, or a Function.
 
callback:Function (default = null) — Optional callback function to be passed the result of evaluating the script or function. The 'this' argument will be the current WeavePath object.

Returns
WeavePath — The current WeavePath object.
forEach()method 
public function forEach(items:Object, visitorFunction:Function):WeavePath

Applies a function to each item in an Array or an Object.

Parameters

items:Object — Either an Array or an Object to iterate over.
 
visitorFunction:Function — A function to be called for each item in items. The function will be called using the current WeavePath object as the 'this' value and will receive three parameters: item, key, items. If items is an Array, the key will be an integer. If items is an Object, the key will be a String.

Returns
WeavePath — The current WeavePath object.
forEachChild()method 
public function forEachChild(... relativePath_visitorFunction):WeavePath

Calls a function for each child of the current WeavePath or the one specified by a relativePath. The function receives child WeavePath objects.

Parameters

... relativePath_visitorFunction — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
WeavePath — The current WeavePath object.
forEachName()method 
public function forEachName(... relativePath_visitorFunction):WeavePath

Calls a function for each child of the current WeavePath or the one specified by a relativePath. The function receives child names.

Parameters

... relativePath_visitorFunction — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
WeavePath — The current WeavePath object.
getChildren()method 
public function getChildren(... relativePath):Array

Gets an Array of child WeavePath objects under the object at the current path or relative to the current path.

Parameters

... relativePath — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
Array — An Array of child WeavePath objects.
getDiff()method 
public function getDiff(... relativePath_previousState):Object

Gets the changes that have occurred since previousState for the object at the current path or relative to the current path.

Parameters

... relativePath_previousState — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
Object — A session state diff.
getNames()method 
public function getNames(... relativePath):Array

Gets an Array of child names under the object at the current path or relative to the current path.

Parameters

... relativePath — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
Array — An Array of child names.
getObject()method 
public function getObject(... relativePath):ILinkableObject

Parameters

... relativePath

Returns
ILinkableObject
getPath()method 
public function getPath(... relativePath):Array

Returns a copy of the current path Array or the path Array of a descendant object.

Parameters

... relativePath — An optional Array (or multiple parameters) specifying descendant names to be appended to the result.

Returns
Array — An Array of successive child names used to identify an object in a Weave session state.
getReverseDiff()method 
public function getReverseDiff(... relativePath_otherState):Object

Gets the changes that would have to occur to get to another state for the object at the current path or relative to the current path.

Parameters

... relativePath_otherState — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
Object — A session state diff.
getSimpleType()method 
public function getSimpleType(... relativePath):String

Gets the simple type (unqualified class name) of the object at the current path or relative to the current path.

Parameters

... relativePath — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
String — The unqualified class name of the object at the current or descendant path, or null if there is no object.
getState()method 
public function getState(... relativePath):Object

Gets the session state of an object at the current path or relative to the current path.

Parameters

... relativePath — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
Object — The session state of the object at the current or descendant path.
getType()method 
public function getType(... relativePath):String

Gets the type (qualified class name) of the object at the current path or relative to the current path.

Parameters

... relativePath — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
String — The qualified class name of the object at the current or descendant path, or null if there is no object.
getTypedState()method 
public function getTypedState(... relativePath):Object

Parameters

... relativePath

Returns
Object
getUntypedState()method 
public function getUntypedState(... relativePath):Object

Parameters

... relativePath

Returns
Object
getValue()method 
public function getValue(script_or_function:*, ... args):Object

Returns the value of an ActionScript expression or variable using the current path as the 'this' argument.

Parameters

script_or_function:* — Either a String containing JavaScript code, or a Function.
 
... args

Returns
Object — The result of evaluating the script or function.
migrate()method 
public static function migrate(source:WeavePath, destination:Weave):void

Parameters

source:WeavePath
 
destination:Weave

pop()method 
public function pop():WeavePath

Returns to the previous WeavePath that spawned the current one with push().

Returns
WeavePath — The parent WeavePath object.
push()method 
public function push(... relativePath):WeavePath

Creates a new WeavePath relative to the current one.

Parameters

... relativePath — An Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
WeavePath — A new WeavePath object which remembers the current WeavePath as its parent.
remove()method 
public function remove(... relativePath):WeavePath

Removes a dynamically created object.

Parameters

... relativePath — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
WeavePath — The current WeavePath object.
removeCallback()method 
public function removeCallback(relevantContext:Object, callback:Function):WeavePath

Removes a callback from the object at the current path or from everywhere.

Parameters

relevantContext:Object — The relevantContext parameter that was given when the callback was added.
 
callback:Function — The callback function.

Returns
WeavePath — The current WeavePath object.
reorder()method 
public function reorder(... orderedNames):WeavePath

Reorders the children of an ILinkableHashMap at the current path.

Parameters

... orderedNames — An Array (or multiple parameters) specifying ordered child names.

Returns
WeavePath — The current WeavePath object.
request()method 
public function request(... relativePath_objectType):WeavePath

Requests that an object be created if it doesn't already exist at the current path (or relative path, if specified). This function can also be used to assert that the object at the current path is of the type you expect it to be.

Parameters

... relativePath_objectType — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
WeavePath — The current WeavePath object.
state()method 
public function state(... relativePath_state):WeavePath

Sets the session state of the object at the current path or relative to the current path. Any existing dynamically created objects that do not appear in the new state will be removed.

Parameters

... relativePath_state — An optional Array (or multiple parameters) specifying descendant names relative to the current path. A child index number may be used in place of a name in the path when its parent object is a LinkableHashMap.

Returns
WeavePath — The current WeavePath object.
toString()method 
public function toString():String

Provides a human-readable string containing the path.

Returns
String
trace()method 
public function trace(... args):WeavePath

Calls weaveTrace() in Weave to print to the log window.

Parameters

... args — A list of parameters to pass to weaveTrace().

Returns
WeavePath — The current WeavePath object.