/ fm / liveswitch / Utility
Class: Utility
fm.liveswitch.Utility
Utility methods.
Table of contents
Constructors
Methods
- getTypeString
- clone
- cloneIntArray
- cloneLongArray
- cloneStringArray
- firstOrDefault
- formatDoubleAsPercent
- generateId
- generateSynchronizationSource
- generateTieBreaker
- getRtpSequenceNumberDelta
- getRtpTimestampDelta
- lastOrDefault
- nullableLongEquals
- singleOrDefault
- splice
- toIntArray
- toList
- toLongArray
- toStringArray
- treeFindLeaves
- treeSearch
Constructors
constructor
+ new Utility(): Utility
Returns: Utility
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:11
Methods
getTypeString
▸ getTypeString(): string
Returns: string
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:9
clone
▸ Static
clone<T>(list
: T[]): T[]
Clones the specified list.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
list |
T[] | The list. |
Returns: T[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:29
cloneIntArray
▸ Static
cloneIntArray(intArray
: number[]): number[]
Clones an array of int values.
Parameters:
Name | Type | Description |
---|---|---|
intArray |
number[] | An array of int values. |
Returns: number[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:44
cloneLongArray
▸ Static
cloneLongArray(longArray
: number[]): number[]
Clones an array of long values.
Parameters:
Name | Type | Description |
---|---|---|
longArray |
number[] | An array of long values. |
Returns: number[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:64
cloneStringArray
▸ Static
cloneStringArray(stringArray
: string[]): string[]
Clones an array of string values.
Parameters:
Name | Type | Description |
---|---|---|
stringArray |
string[] | An array of string values. |
Returns: string[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:84
firstOrDefault
▸ Static
firstOrDefault<T>(array
: T[]): T
Gets the first element in the array or the default value if the array is null or empty.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
array |
T[] | The array. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:105
▸ Static
firstOrDefault<T>(list
: T[]): T
Gets the first element in the list or the default value if the list is null or empty.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
list |
T[] | The list. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:113
formatDoubleAsPercent
▸ Static
formatDoubleAsPercent(value
: number, decimalPlaces
: number): string
Formats a double as a percentage string.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | The value. |
decimalPlaces |
number | The number of decimal places to include. |
Returns: string
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:138
generateId
▸ Static
generateId(): string
Generates a globally unique identifier with no hyphens.
Returns: string
A globally unique identifier with no hyphens.
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:185
generateSynchronizationSource
▸ Static
generateSynchronizationSource(): number
Generates a synchronization source.
Returns: number
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:197
generateTieBreaker
▸ Static
generateTieBreaker(): string
Generates a tie-breaker.
deprecated
Use GenerateId instead.
Returns: string
A tie-breaker.
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:213
getRtpSequenceNumberDelta
▸ Static
getRtpSequenceNumberDelta(rtpSequenceNumber
: number, lastRtpSequenceNumber
: number): number
Retrieves the difference between two RTP sequence numbers while accounting for overflow rollover.
Parameters:
Name | Type | Description |
---|---|---|
rtpSequenceNumber |
number | The current RTP sequence number. |
lastRtpSequenceNumber |
number | The last (previous) RTP sequence number. |
Returns: number
The difference between the two RTP sequence numbers.
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:229
getRtpTimestampDelta
▸ Static
getRtpTimestampDelta(rtpTimestamp
: number, lastRtpTimestamp
: number): number
Retrieves the difference between two RTP timestamps while accounting for overflow rollover.
Parameters:
Name | Type | Description |
---|---|---|
rtpTimestamp |
number | The current RTP timestamp. |
lastRtpTimestamp |
number | The last (previous) RTP timestamp. |
Returns: number
The difference between the two RTP timestamps.
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:254
lastOrDefault
▸ Static
lastOrDefault<T>(array
: T[]): T
Gets the last element in the array or the default value if the array is null or empty.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
array |
T[] | The array. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:277
▸ Static
lastOrDefault<T>(list
: T[]): T
Gets the last element in the list or the default value if the list is null or empty.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
list |
T[] | The list. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:285
nullableLongEquals
▸ Static
nullableLongEquals(long1
: number, long2
: number): boolean
Compares two nullable longs for equality.
Parameters:
Name | Type | Description |
---|---|---|
long1 |
number | The first long value. |
long2 |
number | The second long value. |
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:310
singleOrDefault
▸ Static
singleOrDefault<T>(array
: T[]): T
Gets the only element in the array or the default value if the array is null or does not have exactly one value.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
array |
T[] | The array. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:324
▸ Static
singleOrDefault<T>(list
: T[]): T
Gets the only element in the list or the default value if the list is null or does not have exactly one value.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
list |
T[] | The list. |
Returns: T
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:332
splice
▸ Static
splice<T>(array
: T[], index
: number, addItems
: T[], createArray
: IFunction1<number, T[]>): T[]
Splices an array.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
array |
T[] | The array. |
index |
number | The splice index. |
addItems |
T[] | The items to add. |
createArray |
IFunction1<number, T[]> | A function that creates an array of the given size. |
Returns: T[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:359
▸ Static
splice<T>(array
: T[], index
: number, removeCount
: number, addItems
: T[], createArray
: IFunction1<number, T[]>): T[]
Splices an array.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
array |
T[] | The array. |
index |
number | The splice index. |
removeCount |
number | The number of items to remove. |
addItems |
T[] | The items to add. |
createArray |
IFunction1<number, T[]> | A function that creates an array of the given size. |
Returns: T[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:370
▸ Static
splice<T>(array
: T[], index
: number, removeCount
: number, createArray
: IFunction1<number, T[]>): T[]
Splices an array.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
array |
T[] | The array. |
index |
number | The splice index. |
removeCount |
number | The number of items to remove. |
createArray |
IFunction1<number, T[]> | A function that creates an array of the given size. |
Returns: T[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:380
toIntArray
▸ Static
toIntArray(intList
: number[]): number[]
Converts a list of int values to an array of int values.
Parameters:
Name | Type | Description |
---|---|---|
intList |
number[] | A list of int values. |
Returns: number[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:433
toList
▸ Static
toList<T>(array
: T[]): T[]
Converts an array to a list.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
array |
T[] | The array. |
Returns: T[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:450
toLongArray
▸ Static
toLongArray(longList
: number[]): number[]
Converts a list of long values to an array of long values.
Parameters:
Name | Type | Description |
---|---|---|
longList |
number[] | A list of long values. |
Returns: number[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:467
toStringArray
▸ Static
toStringArray(stringList
: string[]): string[]
Converts a list of string values to an array of string values.
Parameters:
Name | Type | Description |
---|---|---|
stringList |
string[] | A list of string values. |
Returns: string[]
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:484
treeFindLeaves
▸ Static
treeFindLeaves<T>(root
: T, childrenCallback
: IFunction1<T, T[]>, nodeCallback
: IAction1<T>): void
Enumerates over all nodes in the tree, invoking the callback for each one.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
root |
T | The root. |
childrenCallback |
IFunction1<T, T[]> | The children callback. |
nodeCallback |
IAction1<T> | The node callback. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:503
treeSearch
▸ Static
treeSearch<T>(root
: T, childrenCallback
: IFunction1<T, T[]>, nodeCallback
: IAction1<T>): void
Enumerates over all nodes in the tree, invoking the callback for each one.
Type parameters:
Name |
---|
T |
Parameters:
Name | Type | Description |
---|---|---|
root |
T | The root. |
childrenCallback |
IFunction1<T, T[]> | The children callback. |
nodeCallback |
IAction1<T> | The node callback. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:525