API Docs for:
Show:

SortedList Class

Extends Array
Module: interval-tree2

extended array of objects, always sorted

Methods

bsearch

(
  • val
)
Number

binary search

Parameters:

  • val Any

Returns:

Number:

position of the value

compare

(
  • a
  • b
)
private

comparison function. Compares two objects by this.compareKey

Parameters:

  • a Any
  • b Any

firstPositionOf

(
  • val
)
Number

leftmost position of the given val

Parameters:

  • val Any

Returns:

Number:

leftmost position of the value

insert

(
  • val
)
Number

insert a value

Parameters:

  • val Any

Returns:

Number:

inserted position

lastPositionOf

(
  • val
)
Number

rightmost position of the given val

Parameters:

  • val Any

Returns:

Number:

rightmost position of the value

max

() Number

get maximum value in the list

Returns:

Number:

min

() Number

get minimum value in the list

Returns:

Number:

remove

(
  • pos
)
SortedList

remove the value in the given position

Parameters:

  • pos Number

    position

Returns:

SortedList:

self

Properties

compareKey

String

key name to compare objects. The value of the key must be a number.