Search Results for

    / fm / liveswitch / Utility

    Class: Utility

    fm.liveswitch.Utility

    Utility methods.

    Table of contents

    Constructors

    • constructor

    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

    ▸ Staticclone<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

    ▸ StaticcloneIntArray(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

    ▸ StaticcloneLongArray(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

    ▸ StaticcloneStringArray(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

    ▸ StaticfirstOrDefault<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

    ▸ StaticfirstOrDefault<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

    ▸ StaticformatDoubleAsPercent(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

    ▸ StaticgenerateId(): 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

    ▸ StaticgenerateSynchronizationSource(): number

    Generates a synchronization source.

    Returns: number

    Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:197


    generateTieBreaker

    ▸ StaticgenerateTieBreaker(): string

    Generates a tie-breaker.

    deprecated Use GenerateId instead.

    Returns: string

    A tie-breaker.

    Defined in: Generated/TypeScript/fm.liveswitch/Utility.ts:213


    getRtpSequenceNumberDelta

    ▸ StaticgetRtpSequenceNumberDelta(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

    ▸ StaticgetRtpTimestampDelta(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

    ▸ StaticlastOrDefault<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

    ▸ StaticlastOrDefault<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

    ▸ StaticnullableLongEquals(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

    ▸ StaticsingleOrDefault<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

    ▸ StaticsingleOrDefault<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

    ▸ Staticsplice<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

    ▸ Staticsplice<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

    ▸ Staticsplice<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

    ▸ StatictoIntArray(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

    ▸ StatictoList<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

    ▸ StatictoLongArray(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

    ▸ StatictoStringArray(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

    ▸ StatictreeFindLeaves<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

    ▸ StatictreeSearch<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

    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.15.0