/ fm / liveswitch / Collection
Class: Collection<T, TCollection>
fm.liveswitch.Collection
A collection of values.
Type parameters
Name | Type |
---|---|
T |
- |
TCollection |
Collection<T, TCollection> |
Hierarchy
Collection
Table of contents
Constructors
Methods
- add
- addMany
- addSuccess
- addSuccessNoLock
- any
- arrayFromList
- contains
- createCollection
- first
- firstOrDefault
- forEach
- getCount
- getTypeString
- getValue
- getValues
- last
- lastOrDefault
- remove
- removeAll
- removeFirst
- removeLast
- removeMany
- removeSuccess
- removeSuccessNoLock
- replace
- setValue
- setValues
- single
- singleOrDefault
- toArray
- valueAt
- valueAtOrDefault
- where
Constructors
constructor
+ new Collection<T, TCollection>(): Collection<T, TCollection>
Initializes a new instance of the [[fm.liveswitch.collection]] class.
Type parameters:
Name | Type |
---|---|
T |
- |
TCollection |
Collection<T, TCollection, TCollection> |
Returns: Collection<T, TCollection>
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:17
Methods
add
▸ add(value
: T): boolean
Adds a value.
Parameters:
Name | Type | Description |
---|---|---|
value |
T | The value. |
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:44
addMany
▸ addMany(values
: T[]): void
Adds some values.
Parameters:
Name | Type | Description |
---|---|---|
values |
T[] | The values. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:69
addSuccess
▸ Protected
addSuccess(value
: T): void
Invoked when an element is added to the collection.
Parameters:
Name | Type | Description |
---|---|---|
value |
T | The value. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:95
addSuccessNoLock
▸ Protected
addSuccessNoLock(value
: T): void
Invoked after an element is added to the collection.
Parameters:
Name | Type | Description |
---|---|---|
value |
T | The value. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:107
any
▸ any(): boolean
Determined whether the collection contains at least one value.
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:118
▸ any(predicate
: IFunction1<T, boolean>): boolean
Determined whether the collection contains at least one value that matches the specified predicate.
Parameters:
Name | Type | Description |
---|---|---|
predicate |
IFunction1<T, boolean> | The predicate. |
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:126
arrayFromList
▸ Protected
Abstract
arrayFromList(list
: T[]): T[]
Creates an array from a list.
Parameters:
Name | Type | Description |
---|---|---|
list |
T[] | The list. |
Returns: T[]
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:148
contains
▸ contains(value
: T): boolean
Determines whether the collection contains a value.
Parameters:
Name | Type | Description |
---|---|---|
value |
T | The value. |
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:155
createCollection
▸ Protected
Abstract
createCollection(): TCollection
Creates a collection.
Returns: TCollection
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:170
first
▸ first(): T
Gets the first value. Throws an exception if there are no values in the collection.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:178
▸ first(predicate
: IFunction1<T, boolean>): T
Gets the first value that matches the specified predicate. Throws an exception if there are no such values in the collection.
Parameters:
Name | Type | Description |
---|---|---|
predicate |
IFunction1<T, boolean> | The predicate. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:188
firstOrDefault
▸ firstOrDefault(): T
Gets the first value. Returns a default value if there are no values in the collection.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:214
▸ firstOrDefault(predicate
: IFunction1<T, boolean>): T
Gets the first value that matches the specified predicate. Returns a default value if there are no such values in the collection.
Parameters:
Name | Type | Description |
---|---|---|
predicate |
IFunction1<T, boolean> | The predicate. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:224
forEach
▸ forEach(callback
: IAction2<T, number>): void
Executes a callback function once per value.
Parameters:
Name | Type | Description |
---|---|---|
callback |
IAction2<T, number> | The callback to execute. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:247
getCount
▸ getCount(): number
Gets the count.
Returns: number
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:262
getTypeString
▸ getTypeString(): string
Returns: string
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:9
getValue
▸ getValue(): T
Gets the value.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:274
getValues
▸ getValues(): T[]
Gets the values.
Returns: T[]
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:289
last
▸ last(): T
Gets the last value. Throws an exception if there are no values in the collection.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:303
▸ last(predicate
: IFunction1<T, boolean>): T
Gets the last value that matches the specified predicate. Throws an exception if there are no such values in the collection.
Parameters:
Name | Type | Description |
---|---|---|
predicate |
IFunction1<T, boolean> | The predicate. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:313
lastOrDefault
▸ lastOrDefault(): T
Gets the last value. Returns a default value if there are no values in the collection.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:339
▸ lastOrDefault(predicate
: IFunction1<T, boolean>): T
Gets the last value that matches the specified predicate. Returns a default value if there are no such values in the collection.
Parameters:
Name | Type | Description |
---|---|---|
predicate |
IFunction1<T, boolean> | The predicate. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:349
remove
▸ remove(value
: T): boolean
Removes a value.
Parameters:
Name | Type | Description |
---|---|---|
value |
T | The value. |
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:372
removeAll
▸ removeAll(): void
Removes all values.
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:395
removeFirst
▸ removeFirst(): T
Removes the first value.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:416
▸ removeFirst(condition
: IFunction1<T, boolean>): T
Removes the first value that matches a given condition.
Parameters:
Name | Type |
---|---|
condition |
IFunction1<T, boolean> |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:422
removeLast
▸ removeLast(): T
Removes the last value.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:449
▸ removeLast(condition
: IFunction1<T, boolean>): T
Removes the last value that matches a given condition.
Parameters:
Name | Type |
---|---|
condition |
IFunction1<T, boolean> |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:455
removeMany
▸ removeMany(values
: T[]): void
Removes some values.
Parameters:
Name | Type | Description |
---|---|---|
values |
T[] | The values. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:483
removeSuccess
▸ Protected
removeSuccess(value
: T): void
Invoked when an element is removed from the collection.
Parameters:
Name | Type | Description |
---|---|---|
value |
T | The value. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:508
removeSuccessNoLock
▸ Protected
removeSuccessNoLock(value
: T): void
Invoked after an element is removed from the collection.
Parameters:
Name | Type | Description |
---|---|---|
value |
T | The value. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:520
replace
▸ replace(values
: T[]): void
Replaces the collection with a new set of values.
Parameters:
Name | Type | Description |
---|---|---|
values |
T[] | The values. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:532
setValue
▸ setValue(value
: T): void
Sets the value.
Parameters:
Name | Type |
---|---|
value |
T |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:548
setValues
▸ setValues(value
: T[]): void
Sets the values.
Parameters:
Name | Type |
---|---|
value |
T[] |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:564
single
▸ single(): T
Gets the only value. Throws an exception if there are no values or more than one value in the collection.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:583
▸ single(predicate
: IFunction1<T, boolean>): T
Gets the only value that matches the specified predicate. Throws an exception if there are no values or more than one value in the collection.
Parameters:
Name | Type |
---|---|
predicate |
IFunction1<T, boolean> |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:593
singleOrDefault
▸ singleOrDefault(): T
Gets the only value. Returns a default value if there are no values or more than one value in the collection.
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:620
▸ singleOrDefault(predicate
: IFunction1<T, boolean>): T
Gets the only value that matches the specified predicate. Returns a default value if there are no values or more than one value in the collection.
Parameters:
Name | Type |
---|---|
predicate |
IFunction1<T, boolean> |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:630
toArray
▸ toArray(): T[]
Clones the values into a new array.
Returns: T[]
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:658
valueAt
▸ valueAt(index
: number): T
Gets the value at the specified index. Throws an exception if a value does not exist at that index.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | The index. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:673
valueAtOrDefault
▸ valueAtOrDefault(index
: number): T
Gets the value at the specified index. Returns a default value if a value does not exist at that index.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | The index. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:693
where
▸ where(predicate
: IFunction2<T, number, boolean>): TCollection
Creates a new collection with values that match the specified predicate.
Parameters:
Name | Type | Description |
---|---|---|
predicate |
IFunction2<T, number, boolean> | The predicate. |
Returns: TCollection
Defined in: Generated/TypeScript/fm.liveswitch/Collection.ts:715