API / geotoolkit / util / Tree / Tree
Basic tree representation
| Name | Type |
|---|---|
T | any |
Constructors
Methods
▸ add(data, toNodeData?, equal?): Tree<T>
Adds child tree node with "data" to parent's tree node with "toNodeData"
| Name | Type | Description |
|---|---|---|
data | T | data |
Optional toNodeData | T | parent's tree node data |
Optional equal | (data1: T, data2: T) => boolean | data comparator |
Tree<T>
▸ contains(data, equal?): boolean
Check if the tree contains data
| Name | Type | Description |
|---|---|---|
data | T | data |
Optional equal | (data1: T, data2: T) => boolean | data comparator |
boolean
▸ findBFS(data, equal?): TreeNode<T>
Searches for tree node with "data" (starting with root node)
| Name | Type | Description |
|---|---|---|
data | T | data |
Optional equal | (data1: T, data2: T) => boolean | data comparator |
TreeNode<T>
▸ getClassName(): string
string
▸ getRoot(): TreeNode<T>
Gets root
TreeNode<T>
▸ remove(data): Tree<T>
Removes child tree node with "data"
| Name | Type | Description |
|---|---|---|
data | T | data |
Tree<T>
▸ toString(dataToString?): string
Returns a string representation of this object meaning
| Name | Type | Description |
|---|---|---|
Optional dataToString | (data: string | T) => string | data-to-string representation |
string
A string representation
▸ traverseBFS(visitor, options?): Tree<T>
Traverses with Breadth First Search
| Name | Type | Description |
|---|---|---|
visitor | (node: TreeNode<T>, options: Record<string, any>) => void | tree node visitor |
Optional options | Record<string, any> | options |
Tree<T>
▸ traverseDFS(visitor, preOrder?, options?): Tree<T>
Traverses with Depth First Search
| Name | Type | Description |
|---|---|---|
visitor | (node: TreeNode<T>, options: Record<string, any>) => void | tree node visitor |
Optional preOrder | boolean | preOrder flag |
Optional options | Record<string, any> | options |
Tree<T>
▸ Static getClassName(): string
string