rx-datatable API
    Preparing search index...

    Interface ISortedMap<K, V>

    An interface for a sorted map (dictionary), not including functional/persistent methods.

    interface ISortedMap<K = any, V = any> {
        size: number;
        clear(): void;
        delete(key: K): boolean;
        deleteKeys(keys: K[]): number;
        deleteRange(low: K, high: K, includeHigh: boolean): number;
        entries(firstKey?: K): IterableIterator<[K, V]>;
        forEach(
            callbackFn: (v: V, k: K, map: IMapSource<K, V>) => void,
            thisArg?: any,
        ): void;
        forRange(
            low: K,
            high: K,
            includeHigh: boolean,
            onFound?: (k: K, v: V, counter: number) => void,
            initialCounter?: number,
        ): number;
        get(key: K): V | undefined;
        getRange(
            low: K,
            high: K,
            includeHigh?: boolean,
            maxLength?: number,
        ): [K, V][];
        has(key: K): boolean;
        keys(firstKey?: K): IterableIterator<K>;
        maxKey(): K | undefined;
        minKey(): K | undefined;
        nextHigherKey(key?: K): K | undefined;
        nextHigherPair(key?: K): [K, V] | undefined;
        nextLowerKey(key?: K): K | undefined;
        nextLowerPair(key?: K): [K, V] | undefined;
        reduce<R>(
            callback: (
                previous: R,
                currentPair: [K, V],
                counter: number,
                tree: IMapF<K, V>,
            ) => R,
            initialValue: R,
        ): R;
        reduce<R>(
            callback: (
                previous: R | undefined,
                currentPair: [K, V],
                counter: number,
                tree: IMapF<K, V>,
            ) => R,
        ): R | undefined;
        set(key: K, value: V, overwrite?: boolean): boolean;
        setPairs(pairs: [K, V][], overwrite?: boolean): number;
        values(firstKey?: K): IterableIterator<V>;
    }

    Type Parameters

    • K = any
    • V = any

    Hierarchy (View Summary)

    Index
    size: number

    Returns the number of key/value pairs in the map object.

    • Returns true if an element in the map object existed and has been removed, or false if the element did not exist.

      Parameters

      • key: K

      Returns boolean

    • Deletes a series of keys from the collection.

      Parameters

      • keys: K[]

      Returns number

    • Removes a range of key-value pairs from the B+ tree.

      Parameters

      • low: K

        The first key deleted will be greater than or equal to low.

      • high: K

        Deleting stops when a key larger than this is reached.

      • includeHigh: boolean

        Specifies whether the high key, if present, is deleted.

      Returns number

      The number of key-value pairs that were deleted.

    • Returns an iterator that provides all key-value pairs from the collection (as arrays of length 2).

      Parameters

      • OptionalfirstKey: K

      Returns IterableIterator<[K, V]>

    • Calls callbackFn once for each key-value pair present in the map object. The ES6 Map class sends the value to the callback before the key, so this interface must do likewise.

      Parameters

      • callbackFn: (v: V, k: K, map: IMapSource<K, V>) => void
      • OptionalthisArg: any

      Returns void

    • Calls callback on the specified range of keys, in ascending order by key.

      Parameters

      • low: K

        The first key scanned will be greater than or equal to low.

      • high: K

        Scanning stops when a key larger than this is reached.

      • includeHigh: boolean

        If the high key is present in the map, onFound is called for that final pair if and only if this parameter is true.

      • OptionalonFound: (k: K, v: V, counter: number) => void

        A function that is called for each key-value pair.

      • OptionalinitialCounter: number

        Initial third argument of onFound. This value increases by one each time onFound is called. Default: 0

      Returns number

      Number of pairs found and the number of times callback was called.

    • Returns the value associated to the key, or undefined if there is none.

      Parameters

      • key: K

      Returns V | undefined

    • Builds an array of pairs from the specified range of keys, sorted by key. Each returned pair is also an array: pair[0] is the key, pair[1] is the value.

      Parameters

      • low: K

        The first key in the array will be greater than or equal to low.

      • high: K

        This method returns when a key larger than this is reached.

      • OptionalincludeHigh: boolean

        If the high key is present in the map, its pair will be included in the output if and only if this parameter is true. Note: if the low key is present, it is always included in the output.

      • OptionalmaxLength: number

        Maximum length of the returned array (default: unlimited)

      Returns [K, V][]

      Computational complexity: O(result.length + log size)

    • Returns a boolean asserting whether the key exists in the map object or not.

      Parameters

      • key: K

      Returns boolean

    • Returns a new iterator for iterating the keys of each pair.

      Parameters

      • OptionalfirstKey: K

      Returns IterableIterator<K>

    • Returns the next key larger than the specified key (or undefined if there is none). Also, nextHigherKey(undefined) returns the lowest key.

      Parameters

      • Optionalkey: K

      Returns K | undefined

    • Returns the next pair whose key is larger than the specified key (or undefined if there is none). If key === undefined, this function returns the lowest pair.

      Parameters

      • Optionalkey: K

      Returns [K, V] | undefined

    • Returns the next key smaller than the specified key (or undefined if there is none). Also, nextLowerKey(undefined) returns the highest key.

      Parameters

      • Optionalkey: K

      Returns K | undefined

    • Returns the next pair whose key is smaller than the specified key (or undefined if there is none). If key === undefined, this function returns the highest pair.

      Parameters

      • Optionalkey: K

      Returns [K, V] | undefined

    • Performs a reduce operation like the reduce method of Array. It is used to combine all pairs into a single value, or perform conversions.

      Type Parameters

      • R

      Parameters

      • callback: (previous: R, currentPair: [K, V], counter: number, tree: IMapF<K, V>) => R
      • initialValue: R

      Returns R

    • Performs a reduce operation like the reduce method of Array. It is used to combine all pairs into a single value, or perform conversions.

      Type Parameters

      • R

      Parameters

      • callback: (
            previous: R | undefined,
            currentPair: [K, V],
            counter: number,
            tree: IMapF<K, V>,
        ) => R

      Returns R | undefined

    • Adds or overwrites a key-value pair in the sorted map.

      Parameters

      • key: K

        the key is used to determine the sort order of data in the tree.

      • value: V

        data to associate with the key

      • Optionaloverwrite: boolean

        Whether to overwrite an existing key-value pair (default: true). If this is false and there is an existing key-value pair then the call to this method has no effect.

      Returns boolean

      true if a new key-value pair was added, false if the key already existed.

    • Adds all pairs from a list of key-value pairs.

      Parameters

      • pairs: [K, V][]

        Pairs to add to this tree. If there are duplicate keys, later pairs currently overwrite earlier ones (e.g. [[0,1],[0,7]] associates 0 with 7.)

      • Optionaloverwrite: boolean

        Whether to overwrite pairs that already exist (if false, pairs[i] is ignored when the key pairs[i][0] already exists.)

      Returns number

      The number of pairs added to the collection.

    • Returns a new iterator for iterating the values of each pair.

      Parameters

      • OptionalfirstKey: K

      Returns IterableIterator<V>