API Docs for:
Show:

IntervalTree Class

interval tree

Methods

add

(
  • start
  • end
  • [id]
)
Interval public

add one interval

Parameters:

  • start Number

    start of the interval to create

  • end Number

    end of the interval to create

  • [id] String | Number optional

    identifier to distinguish intervals. Automatically defiend when not set.

Returns:

createNode

(
  • center
)
Node private

create node by center

Parameters:

  • center Number

Returns:

Node:

node

insert

(
  • interval
  • node
)
Interval private

insert interval to the given node

Parameters:

Returns:

Interval:

inserted interval

pointSearch

(
  • val
  • [node]
)
Array(Interval) public

search intervals at the given node

Parameters:

  • val Number
  • [node] Node optional

    current node to search. default is this.root

Returns:

Array(Interval):

rangeSearch

(
  • start
  • end
)
Array(Interval) public

returns intervals which covers the given start-end interval

Parameters:

  • start Number

    start of the interval

  • end Number

    end of the interval

Returns:

Array(Interval):

remove

(
  • id
)
public

removes an interval of the given id

Parameters:

  • id Number | String

    id of the interval to remove

Properties

idCandidate

Number

unique id candidate of interval without id to be added next time

intervalsById

Object(Interval)

interval id => interval

nodesByCenter

Object(Node)

center => node

nodesById

Object(Node)

interval id => node

pointTree

SortedList(Point)

sorted list of whole point

root

Node

root node