Class Index | File Index

Classes


Class R.engine.PooledObject

Pooled objects are created as needed, and reused from a static pool of all objects, organized by classname. When an object is created, if one is not available in the pool, a new object is created. When the object is destroyed, it is returned to the pool so it can be used again. This has the effect of minimizing the requirement for garbage collection, reducing cycles needed to clean up dead objects.
Defined in: pooledobject.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Create an instance of this object, assigning a global identifies to it.
Method Summary
Method Attributes Method Name and Description
 
Clear all of the spatial container model data.
 
Destroy this object instance (remove it from the Engine).
 
Get the managed Id of this object within the Engine.
 
Get the original name this object was created with.
 
Get the model data associated with an object.
 
Returns an object that assigns getter and setter methods for exposed properties of an object.
 
Returns true if the object has been destroyed.
 
When a pooled object is destroyed, its release() method will be called so it has a chance to clean up instance variables before being put back into the pool for reuse.
 
setName(name)
Set the name of the object.
 
setObjectDataModel(key, value)
Set a key, within the object's data model, to a specific value.
 
Write out the Id of the object and its class name
 
toXML(indent)
Serialize the object to XML.
Class Detail
R.engine.PooledObject(name)
Create an instance of this object, assigning a global identifies to it.
Parameters:
name
{String} The name of the object within the engine.
Method Detail
clearObjectDataModel()
Clear all of the spatial container model data.

destroy()
Destroy this object instance (remove it from the Engine). The object's release() method is called after destruction so it can be returned to the pool of objects to be used again.

{String} getId()
Get the managed Id of this object within the Engine.
Returns:
{String}

{String} getName()
Get the original name this object was created with.
Returns:
{String} The name used when creating this object

getObjectDataModel(key)
Get the model data associated with an object. If key is provided, only the data for key will be returned. If the data has not yet been assigned, an empty object will be created to contain the data.
Parameters:
key Optional
{String} Optional key which contains the data, or null for the entire data model.

{Object} getProperties()
Returns an object that assigns getter and setter methods for exposed properties of an object.
Returns:
{Object} An object which contains getter and setter methods.

{Boolean} isDestroyed()
Returns true if the object has been destroyed. For objects which are being updated by containers, this method is used to determine if the object should be updated. It is important to check this method if you are outside the normal bounds of updating an object. For example, if an object is drawing its bounding box using it's collision component, the component may have been destroyed along with the object, by another object. Checking to see if the object is destroyed before calling such method would prevent an exception being thrown when trying to access the component which was destroyed as well.
Returns:
{Boolean}

release()
When a pooled object is destroyed, its release() method will be called so it has a chance to clean up instance variables before being put back into the pool for reuse. The variables should be returned to an "uninitialized" state.

setName(name)
Set the name of the object.
Parameters:
name
{String} The name for the object

setObjectDataModel(key, value)
Set a key, within the object's data model, to a specific value.
Parameters:
key
{String} The key to set the data for
value
{Object} The value to assign to the key

{String} toString()
Write out the Id of the object and its class name
Returns:
{String}

{String} toXML(indent)
Serialize the object to XML.
Parameters:
indent
Returns:
{String}

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 18 2013 16:09:18 GMT-0400 (EDT)