Constructors

Properties

nilNode: Node
root: null | Node

Accessors

  • get items(): any[]
  • Returns array of items (<key,value> pairs) in the ascended keys order

    Returns any[]

  • get keys(): any[]
  • Returns array of sorted keys in the ascending order

    Returns any[]

  • get size(): number
  • Returns number of items stored in the interval tree

    Returns number

  • get values(): any[]
  • Return array of values in the ascending keys order

    Returns any[]

Methods

  • Clear tree

    Returns void

  • Returns true if item {key,value} exist in the tree

    Parameters

    • key: any

      interval correspondent to keys stored in the tree

    • value: any = key

      value object to be checked

    Returns boolean

    true if item {key, value} exist in the tree, false otherwise

  • Tree visitor. For each node implement a callback function.
    Method calls a callback function with two parameters (key, value)

    Parameters

    • visitor: ((key: any, value: any) => {})

      function to be called for each tree item

        • (key, value): {}
        • Parameters

          • key: any
          • value: any

          Returns {}

      Returns void

    • Insert new item into interval tree

      Parameters

      • key: [number, number] | Interval

        interval object or array of two numbers [low, high]

      • value: any = key

        value representing any object (optional)

      Returns null | Node

      returns reference to inserted node as an object {key:NumberInterval, value: value}

    • Returns true if intersection between given and any interval stored in the tree found

      Parameters

      • interval: any

        search interval or tuple [low, high]

      Returns boolean

    • Returns true if tree is empty

      Returns boolean

    • Left rotate subtree around given node. exchange x.right and x, and take x.right.left as x.right

      Parameters

      Returns void

    • Value Mapper. Walk through every node and map node value to another value

      Parameters

      • callback: ((value: any, key: any) => {})

        function to be called for each tree item

          • (value, key): {}
          • Parameters

            • value: any
            • key: any

            Returns {}

        Returns IntervalTree

      • Calculate max property for all nodes in the path from given node to the root

        Parameters

        Returns void

      • Remove entry {key, value} from the tree

        Parameters

        • key: any

          interval correspondent to keys stored in the tree

        • value: any = key

          value object

        Returns null | Node

        deleted node or null if node not found

      • Right rotate subtree around given node.

        Parameters

        Returns void

      • Returns array of entry values which keys intersect with given interval
        If no values stored in the tree, returns array of keys which intersect given interval

        Parameters

        • interval: any

          search interval, or tuple [low, high]

        • outputMapperFn: ((value: any, key: any) => any) = ...

          optional function that maps (value, key) to custom output

            • (value, key): any
            • Parameters

              • value: any
              • key: any

              Returns any

        Returns any[]

      • Throw error if not every path from root to bottom has same black height

        Parameters

        Returns number

      • Return true if all red nodes have exactly two black child nodes

        Returns boolean

      • Transplant subtree v in place of subtree u. replace u.parent.left or u.parent.right with v

        Parameters

        Returns void

      • Delete node from the tree, and fixup tree properties

        Parameters

        Returns void

      • Recolor nodes and perform rotations to preserve red-black tree properties after delete.

        Parameters

        Returns void

      • Returns true if intersection between given and any interval stored in the tree found

        Parameters

        Returns boolean

      • Insert new node into the tree.

        Parameters

        Returns void

      • Recolor nodes and perform rotations to preserve red-black tree properties after insert.

        Parameters

        Returns void

      • Return node with minimal key in the subtree

        Parameters

        • currentNode: null | Node

        Returns Node

      • Tree search. Returns node if found, null otherwise

        Parameters

        Returns null | Node

      • Tree search for interval intersection. save all intersection nodes found as array in respNodes.

        Parameters

        Returns void

      • Return successor of the given node.

        Parameters

        Returns null | Node

      • Walk through the tree and call callback function for each node

        Parameters

        • root: null | Node
        • callback: Function

        Returns void