An object pool for recycling of object instances extending Poolable.
Cost/Benefit :
Cost - The pool can only contain objects extending Poolable.
Benefit - The pool can very quickly determine if an object is elligable for storage without iteration.
Benefit - The pool can also know if an instance of Poolable is already stored in a different pool instance.
Benefit - The pool can grow as needed, if it is empty
Cost - However, refilling the pool when it is empty might incur a time cost with sufficiently large capacity. Set the replenishPercentage to a lower number if this is a concern.
Returns an instance of Poolable. If get() is called with an empty pool, the pool will be
replenished. If the pool capacity is sufficiently large, this could come at a performance
cost.
Returns the capacity of this object pool. Note : The pool will automatically resize
to contain additional objects if the user tries to add more objects than the pool's
capacity allows, but this comes at a performance cost.
Returns number
The capacity of the pool.
getPoolCount
getPoolCount():any
Returns the number of objects remaining in the pool, for diagnostic purposes.
Recycle an instance of Poolable that this pool is capable of generating.
The T instance passed must not already exist inside this or any other ObjectPool instance.
An object pool for recycling of object instances extending Poolable.
Cost/Benefit : Cost - The pool can only contain objects extending Poolable. Benefit - The pool can very quickly determine if an object is elligable for storage without iteration. Benefit - The pool can also know if an instance of Poolable is already stored in a different pool instance. Benefit - The pool can grow as needed, if it is empty Cost - However, refilling the pool when it is empty might incur a time cost with sufficiently large capacity. Set the replenishPercentage to a lower number if this is a concern.
Created by Tony Patino on 6/20/16.