Class R.struct.HashContainer
Extends
R.struct.Container.
A hash container is a logical collection of objects. A hash container
is a container with a backing object for faster lookups. Objects within
the container must have unique names. When the container is destroyed, none of the
objects within the container are destroyed with it. Call #cleanUp to
destroy all of the objects in the container.
Defined in: hashcontainer.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.struct.HashContainer(containerName)
Create a hashed container object.
|
- Fields borrowed from class R.struct.Container:
- EMPTY
Method Attributes | Method Name and Description |
---|---|
add(key, obj)
Add an object to the container.
|
|
cleanUp()
Cleans up the references to the objects (destroys them) within
the container.
|
|
clear()
Remove all objects from the container.
|
|
get(idx)
If a number is provided, the request will be passed to the
base object, otherwise a name is assumed and the hash will
be retrieved.
|
|
Get the class name of this object
|
|
isInHash(name)
Returns true if the object name is already in
the hash.
|
|
release()
Release the object back into the object pool.
|
|
remove(obj)
Remove an object from the container.
|
|
removeAtIndex(idx)
Remove an object from the container at the specified index.
|
|
removeHash(name)
Remove the object with the given key name from the container.
|
- Methods borrowed from class R.struct.Container:
- addAll, append, clone, concat, contains, destroy, filter, forEach, fromArray, getAll, getObjects, getProperties, insert, iterator, reduce, replace, replaceAt, size, sort, subset, toXML
- Methods borrowed from class R.engine.BaseObject:
- addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent, update
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, isDestroyed, setName, setObjectDataModel, toString
Class Detail
R.struct.HashContainer(containerName)
Create a hashed container object.
- Parameters:
- containerName
- {String} The name of the container. Default: Container
Method Detail
add(key, obj)
Add an object to the container.
- Parameters:
- key
- {String} The name of the object to store. Names must be unique or the object with that name will be overwritten.
- obj
- {BaseObject} The object to add to the container.
cleanUp()
Cleans up the references to the objects (destroys them) within
the container.
clear()
Remove all objects from the container. None of the objects are
destroyed.
{Object}
get(idx)
If a number is provided, the request will be passed to the
base object, otherwise a name is assumed and the hash will
be retrieved.
- Parameters:
- idx
- {Number|String} The index or hash of the object to get
- Returns:
- {Object}
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} "R.struct.HashContainer"
{Boolean}
isInHash(name)
Returns true if the object name is already in
the hash.
- Parameters:
- name
- {String} The name of the hash to check
- Returns:
- {Boolean}
release()
Release the object back into the object pool.
{Object}
remove(obj)
Remove an object from the container. The object is
not destroyed when it is removed from the container.
- Parameters:
- obj
- {BaseObject} The object to remove from the container.
- Returns:
- {Object} The object removed from the container
{Object}
removeAtIndex(idx)
Remove an object from the container at the specified index.
The object is not destroyed when it is removed.
- Parameters:
- idx
- {Number} An index between zero and the size of the container minus 1.
- Returns:
- {Object} The object removed from the container.
{Object}
removeHash(name)
Remove the object with the given key name from the container.
- Parameters:
- name
- {String} The object to remove
- Returns:
- {Object} The object removed