An in-memory B-tree structure that implements the Map interface.

Type Parameters

  • K

  • V

Hierarchy

  • SyncMapBatchAdapter<K, V>
    • BTreeMap

Implements

Constructors

  • Type Parameters

    • K

    • V

    Parameters

    • order: number = 5

      Order of the tree, which is the maximum branching factor / number of children of a node. Must be >= 2.

    • compare: ((a, b) => number) = ...

      Function that defines the sort order of keys.

        • (a, b): number
        • Function that defines the sort order of keys.

          Parameters

          • a: K
          • b: K

          Returns number

    Returns BTreeMap<K, V>

Properties

children: BTreeMap<K, V>[] = []
compare: ((a, b) => number) = ...

Type declaration

    • (a, b): number
    • Function that defines the sort order of keys.

      Parameters

      • a: K
      • b: K

      Returns number

nodeKeys: K[] = []
nodeValues: V[] = []
order: number = 5

Order of the tree, which is the maximum branching factor / number of children of a node. Must be >= 2.

Accessors

  • get size(): number
  • Returns the number of elements in the tree. Note that this is an O(N) operation that counts the number of elements in each tree node.

    Returns number

Methods

  • Finds the index at this node that given key should be inserted at, and whether there is an existing matching key at node.

    Parameters

    • key: K

    Returns [index: number, match: boolean]

  • Parameters

    • callbackfn: ((value, key, tree) => void)
        • (value, key, tree): void
        • Parameters

          Returns void

    • Optional thisArg: unknown

    Returns void

  • Iterates through given bounds

    Parameters

    • lower: undefined | K
    • upper: undefined | K
    • lowerInclusive: boolean
    • upperInclusive: boolean
    • limit: number

    Returns IterableIterator<[K, V]>

  • Reverse iterates through given bounds

    Parameters

    • lower: undefined | K
    • upper: undefined | K
    • lowerInclusive: boolean
    • upperInclusive: boolean
    • limit: number

    Returns IterableIterator<[K, V]>

Generated using TypeDoc