Members
Methods
exist(key, value) → {boolean}
Returns true if item {key,value} exist in the tree
Parameters:
| Name | Type | Description |
|---|---|---|
key |
interval correspondent to keys stored in the tree | |
value |
value object to be checked |
Returns:
- Type:
-
boolean
- true if item {key, value} exist in the tree, false otherwise
forEach(visitor(key,value))
Tree visitor. For each node implement a callback function.
Method calls a callback function with two parameters (key, value)
Method calls a callback function with two parameters (key, value)
Parameters:
| Name | Type | Description |
|---|---|---|
visitor(key,value) |
function to be called for each tree item |
insert(key, value) → {Node}
Insert new item into interval tree
Parameters:
| Name | Type | Description |
|---|---|---|
key |
interval object or array of two numbers [low, high] | |
value |
value representing any object (optional) |
Returns:
- Type:
-
Node
- returns reference to inserted node as an object {key:interval, value: value}
map(callback(value,)
Value Mapper. Walk through every node and map node value to another value
Parameters:
| Name | Type | Description |
|---|---|---|
callback(value, |
key) - function to be called for each tree item |
remove(key, value) → {boolean}
Remove entry {key, value} from the tree
Parameters:
| Name | Type | Description |
|---|---|---|
key |
interval correspondent to keys stored in the tree | |
value |
- value object |
Returns:
- Type:
-
boolean
- true if item {key, value} deleted, false if not found
search(interval) → {Array}
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
If no values stored in the tree, returns array of keys which intersect given interval
Parameters:
| Name | Type | Description |
|---|---|---|
interval |
search interval, or array [low, high] |
Returns:
- Type:
-
Array