Options
All
  • Public
  • Public/Protected
  • All
Menu

Abstract class used as template for high level tree classes.

Type parameters

  • T

Hierarchy

Implements

Index

Constructors

Protected constructor

Properties

checkKeyEquality

checkKeyEquality: checkKeyEquality

Default function only checks key validity of number, string, and Date. This function also only uses '===' for the comparison. Supply a custom function in the constructor to use properly with your data types.

checkValueEquality

checkValueEquality: checkValueEquality

Default function only checks value equality of number, string, and Date. THis function also only uses '===' for the comparison. Supply a custom function in the constructor to use properly with your data types.

compareKeys

compareKeys: compareKeys

Default function compares only number and string other wise the user will need to supply a custom key comparison function to use this Node Tree model properly.

compareValues

compareValues: compareValues

Default function compares only number and string otherwise the use will need to supply a custom value comparison function to use this Node Tree model properly.

key

key: ASNDBS

The key used to find this Node

left

left: Node<T> | null = null

Holds a child of this Node type if given

type

{any}

options

options: INodeConstructor<Node<T>>

parent

parent: Node<T> | null

Holds the parent of this Node type if it exists

right

right: Node<T> | null = null

Holds a child of this Node type if given

type

{any}

unique

unique: boolean

set in the constructor to have only unique keys

value

value: SNDBSA

The value this Node holds

Methods

checkAllNodesFullfillCondition

  • Compare all keys, if there is no key then node fails then tree fails validation check. keys have to be of the same type.

    Parameters

    Returns void

checkInternalPointers

  • checkInternalPointers(): void

checkIsNode

  • checkIsNode(): void

checkNodeOrdering

  • checkNodeOrdering(): void

executeOnEveryNode

  • executeOnEveryNode(fn: any): any

getEqualityBounds

  • getEqualityBounds(query: INEQuery): boolean

getLowerBoundMatcher

getMaxKey

getMaxKeyDescendant

  • getMaxKeyDescendant<T>(): Node<T>

getMinKey

getMinKeyDescendant

  • getMinKeyDescendant<T>(): Node<T>

getNumberOfKeys

  • getNumberOfKeys(): number

getTreeAsArrayOfArrays

  • getTreeAsArrayOfArrays<T>(): any[]
  • Returns binary tree as an array of arrays. Example: Inserting 0 - 4 keys in AVL tree would return this example with this method. inserts them as they would be seen in the binary tree 1 / \ 0 3 / \ / \ null null 2 4

    [ [ { key: 1, value: [Object] }], [{key: 0, value: [Object]},{key: 3, value: [Object]}], [ null, null, {key: 2, value: [Object]}, {key: 4, value: [Object]}] ]

    Type parameters

    • T

    Returns any[]

getTreeHeight

  • getTreeHeight<T>(tree: Node<T>): number

getUpperBoundMatcher

query

returnThisNode

  • returnThisNode(): this

search

toJSON

  • toJSON<T>(): any
  • Turn tree into JSON with an array of objects holding the key and value Requires that key and value can be turned into JSON

    Type parameters

    • T

    Returns any

Generated using TypeDoc