ObjectPool<T extends PoolAble> class
Constructors
-
ObjectPool({required int withCapacity, required T object})
-
Methods
-
get()
→ T
-
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.
-
getPoolCapacity()
→ int
-
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.
-
getPoolCount()
→ int
-
Returns the number of objects remaining in the pool, for diagnostic purposes.
-
getPoolId()
→ int?
-
Returns the id of the given pool instance.
-
getReplenishPercentage()
→ double?
-
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
recycle1(T object)
→ void
-
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.
-
recycle2(List<T> objects)
→ void
-
Recycle a List of Poolables that this pool is capable of generating.
The T instances passed must not already exist inside this or any other ObjectPool instance.
-
refillPool1()
→ void
-
-
refillPool2(double percentage)
→ void
-
-
resizePool()
→ void
-
-
setReplenishPercentage(double percentage)
→ void
-
Set the percentage of the pool to replenish on empty. Valid values are between
0.00f and 1.00f
-
toString()
→ String
-
A string representation of this object.
inherited
Static Properties
-
ids
↔ int
-
getter/setter pair
Static Methods
-
create(int withCapacity, PoolAble object)
→ ObjectPool<PoolAble>
-
Returns an ObjectPool instance, of a given starting capacity, that recycles instances of a given Poolable object.