/ fm / liveswitch / Pool
Class: Pool<T>
fm.liveswitch.Pool
A pool of objects.
Type parameters
Name |
---|
T |
Table of contents
Constructors
Methods
Constructors
constructor
+ new Pool<T>(createObject
: IFunction0<T>): Pool<T>
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.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
createObject |
IFunction0<T> | A function that creates an object. |
Returns: Pool<T>
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:32
+ new Pool<T>(createObject
: IFunction0<T>, minSize
: number): Pool<T>
Initializes a new instance of the [[fm.liveswitch.pool]] class with a specified minimum size and a maximum size of 2,147,483,647.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
createObject |
IFunction0<T> | A function that creates an object. |
minSize |
number | The minimum size. |
Returns: Pool<T>
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:40
+ new Pool<T>(createObject
: IFunction0<T>, minSize
: number, maxSize
: number): Pool<T>
Initializes a new instance of the [[fm.liveswitch.pool]] class. with a specified minimum size and a specified maximum size.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
createObject |
IFunction0<T> | A function that creates an object. |
minSize |
number | The minimum size. |
maxSize |
number | The maximum size. |
Returns: Pool<T>
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:49
Methods
destroy
▸ destroy(destroyCallback
: IAction1<T>): boolean
Removes all items from the pool and calls a callback for each one.
Parameters:
Name | Type |
---|---|
destroyCallback |
IAction1<T> |
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:187
fmliveswitchPoolInit
▸ Private
fmliveswitchPoolInit(): void
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:27
get
▸ get(): T
Gets an object.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:207
getAvailable
▸ getAvailable(): number
Gets the number of available objects.
Returns: number
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:230
getMaxSize
▸ getMaxSize(): number
Gets the maximum size. Value must be >= 0. A value of 0 indicates no maximum.
Returns: number
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:243
getMinSize
▸ getMinSize(): number
Gets the minimum size. Value must be >= 0.
Returns: number
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:255
getSize
▸ getSize(): number
Gets the current size of the pool.
Returns: number
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:267
getTypeString
▸ getTypeString(): string
Returns: string
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:9
put
▸ put(item
: T): boolean
Put an object back.
Parameters:
Name | Type |
---|---|
item |
T |
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/Pool.ts:280