Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • K

  • V

Hierarchy

  • AVLTree

Index

Constructors

constructor

  • new AVLTree(name: string): AVLTree

Accessors

height

  • get height(): u32

len

  • get len(): u32

rootKey

  • get rootKey(): K

size

  • get size(): u32

Methods

ceilKey

  • ceilKey(key: K): K

clear

  • clear(): void

containsKey

  • containsKey(key: K): bool

delete

  • delete(key: K): void

entries

  • entries(start: K, end: K, inclusive?: boolean): MapEntry<K, V>[]
  • Get a range of entries from a start key (inclusive) to an end key (exclusive by default). If end is greater than max key, include start to max inclusive.

    Parameters

    • start: K

      Key for lower bound (inclusive).

    • end: K

      Key for upper bound (exclusive by default).

    • Default value inclusive: boolean = false

      Set to false if upper bound should be exclusive, true if upper bound should be inclusive

    Returns MapEntry<K, V>[]

    Range of entries corresponding to keys within start and end bounds.

floorKey

  • floorKey(key: K): K

get

  • get(key: K, defaultValue?: V | null): V | null
  • Retrieves a related value for a given key or uses the defaultValue if not key is found

    Parameters

    • key: K

      Key of the element.

    • Default value defaultValue: V | null = null

    Returns V | null

    Value for the given key or the default value.

getSome

  • getSome(key: K): V
  • Retrieves the related value for a given key, or throws error "key not found"

    Parameters

    • key: K

      Key of the element.

    Returns V

    Value for the given key or the default value.

has

  • has(key: K): bool

higher

  • higher(key: K): K
  • Returns the minimum key that is strictly greater than the key. Throws if empty or if key is higher than or equal to this.max().

    Parameters

    • key: K

      Key for upper bound (exclusive).

    Returns K

    Minimum key that is strictly greater than given key.

higherOrEqual

  • higherOrEqual(key: K): K
  • Returns the minimum key that is greater or equal than the key. Throws if empty or if key is higher than this.max().

    Parameters

    • key: K

      Key for upper bound (inclusive).

    Returns K

    Minimum key that is greater or equal to given key.

insert

  • insert(key: K, value: V): void

keys

  • keys(start: K, end: K, inclusive?: boolean): K[]
  • Get a range of keys from a start key (inclusive) to an end key (exclusive by default). If end is greater than max key, include start to max inclusive.

    Parameters

    • start: K

      Key for lower bound (inclusive).

    • end: K

      Key for upper bound (exclusive by default).

    • Default value inclusive: boolean = false

      Set to false if upper bound should be exclusive, true if upper bound should be inclusive

    Returns K[]

    Range of keys within start and end bounds.

lower

  • lower(key: K): K
  • Returns the maximum key that is strictly less than the key. Throws if empty or if key is lower than or equal to this.min().

    Parameters

    • key: K

      Key for lower bound (exclusive).

    Returns K

    Maximum key that is strictly less than given key.

lowerOrEqual

  • lowerOrEqual(key: K): K
  • Returns the maximum key that is less or equal than the key. Throws if empty or if key is lower than this.min().

    Parameters

    • key: K

      Key for lower bound (inclusive).

    Returns K

    Maximum key that is less than or equal to given key.

max

  • max(): K

min

  • min(): K

range

  • range(start: K, end: K, inclusive?: boolean): MapEntry<K, V>[]

remove

  • remove(key: K): void

set

  • set(key: K, value: V): void
  • If key is not present in the tree, a new node is added with the value. Otherwise update the node with the new value.

    Parameters

    • key: K

      Key of the element.

    • value: V

      The new value of the element.

    Returns void

values

  • values(start: K, end: K, inclusive?: boolean): V[]
  • Get a range of values from a start key (inclusive) to an end key (exclusive by default). If end is greater than max key, include start to max inclusive.

    Parameters

    • start: K

      Key for lower bound (inclusive).

    • end: K

      Key for upper bound (exclusive by default).

    • Default value inclusive: boolean = false

      Set to false if upper bound should be exclusive, true if upper bound should be inclusive

    Returns V[]

    Range of values corresponding to keys within start and end bounds.

Generated using TypeDoc