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.
An instance of Poolable object T
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.
The capacity of the pool.
Returns the number of objects remaining in the pool, for diagnostic purposes.
The number of objects remaining in the pool.
Returns the id of the given pool instance.
an integer ID belonging to this pool instance.
Set the percentage of the pool to replenish on empty. Valid values are between 0.00 and 1.00
a value between 0 and 1, representing the percentage of the pool to replenish.
Static
createReturns an ObjectPool instance, of a given starting capacity, that recycles instances of a given Poolable object.
A positive integer value.
An instance of the object that the pool should recycle.
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.