A pool of objects. More...
Public Member Functions | |
boolean | destroy (fm.liveswitch.IAction1< T > destroyCallback) |
Removes all items from the pool and calls a callback for each one. More... | |
T | get () |
Gets an object. More... | |
int | getAvailable () |
Gets the number of available objects. More... | |
int | getMaxSize () |
Gets the maximum size. More... | |
int | getMinSize () |
Gets the minimum size. More... | |
int | getSize () |
Gets the current size of the pool. More... | |
Pool (fm.liveswitch.IFunction0< T > createObject) | |
Initializes a new instance of the fm.liveswitch.Pool class with a minimum size of 0 and a maximum size of 2,147,483,647. More... | |
Pool (fm.liveswitch.IFunction0< T > createObject, int minSize) | |
Initializes a new instance of the fm.liveswitch.Pool class with a specified minimum size and a maximum size of 2,147,483,647. More... | |
Pool (fm.liveswitch.IFunction0< T > createObject, int minSize, int maxSize) | |
Initializes a new instance of the fm.liveswitch.Pool class. More... | |
boolean | put (T item) |
Put an object back. More... | |
A pool of objects.
fm.liveswitch.Pool< T >.Pool | ( | fm.liveswitch.IFunction0< T > | createObject | ) |
Initializes a new instance of the fm.liveswitch.Pool class with a minimum size of 0 and a maximum size of 2,147,483,647.
createObject | A function that creates an object. |
fm.liveswitch.Pool< T >.Pool | ( | fm.liveswitch.IFunction0< T > | createObject, |
int | minSize | ||
) |
Initializes a new instance of the fm.liveswitch.Pool class with a specified minimum size and a maximum size of 2,147,483,647.
createObject | A function that creates an object. |
minSize | The minimum size. |
fm.liveswitch.Pool< T >.Pool | ( | fm.liveswitch.IFunction0< T > | createObject, |
int | minSize, | ||
int | maxSize | ||
) |
Initializes a new instance of the fm.liveswitch.Pool class.
with a specified minimum size and a specified maximum size.
createObject | A function that creates an object. |
minSize | The minimum size. |
maxSize | The maximum size. |
boolean fm.liveswitch.Pool< T >.destroy | ( | fm.liveswitch.IAction1< T > | destroyCallback | ) |
Removes all items from the pool and calls a callback for each one.
destroyCallback |
T fm.liveswitch.Pool< T >.get | ( | ) |
Gets an object.
int fm.liveswitch.Pool< T >.getAvailable | ( | ) |
Gets the number of available objects.
int fm.liveswitch.Pool< T >.getMaxSize | ( | ) |
Gets the maximum size.
Value must be >= 0. A value of 0 indicates no maximum.
int fm.liveswitch.Pool< T >.getMinSize | ( | ) |
Gets the minimum size.
Value must be >= 0.
int fm.liveswitch.Pool< T >.getSize | ( | ) |
Gets the current size of the pool.
boolean fm.liveswitch.Pool< T >.put | ( | T | item | ) |
Put an object back.
item |