Class comb.collections.Pool
Base class for a pool.
Defined in: Pool.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
the total number of objects in the pool, including free and in use objects.
|
|
the number of free objects in this pool.
|
|
the number of objects in use in this pool.
|
|
the maximum number of objects this pool should contain
|
|
the minimum number of objects this pool should contain.
|
Method Attributes | Method Name and Description |
---|---|
Creates a new object for this pool.
|
|
Retrieves an object from this pool.
|
|
removeObject(obj)
Removes an object from the pool, this can be overriden to provide any
teardown of objects that needs to take place.
|
|
returnObject(obj)
Returns an object to this pool.
|
|
validate(obj)
Validates an object in this pool.
|
Field Detail
{Number}
count
the total number of objects in the pool, including free and in use objects.
{Number}
freeCount
the number of free objects in this pool.
{Number}
inUseCount
the number of objects in use in this pool.
{Number}
maxObjects
the maximum number of objects this pool should contain
- Default Value:
- 1
{Number}
minObjects
the minimum number of objects this pool should contain.
- Default Value:
- 0
Method Detail
{Object}
createObject()
Creates a new object for this pool.
*
THIS SHOULD BE OVERRIDDEN TO ADD THE CORRECT TYPE OF OBJECT
- Returns:
- {Object} be default just creates an object.
{*}
getObject()
Retrieves an object from this pool.
`
- Returns:
- {*} an object to contained in this pool
{*}
removeObject(obj)
Removes an object from the pool, this can be overriden to provide any
teardown of objects that needs to take place.
- Parameters:
- {*} obj
- the object that needs to be removed.
- Returns:
- {*} the object removed.
returnObject(obj)
Returns an object to this pool. The object is validated before it is returned to the pool,
if the validation fails then it is removed from the pool;
- Parameters:
- {*} obj
- the object to return to the pool
validate(obj)
Validates an object in this pool.
THIS SHOULD BE OVERRIDDEN TO VALIDATE
- Parameters:
- {*} obj
- the object to validate.