Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AnchorLogootNode

Hierarchy

Index

Constructors

constructor

Properties

clk

clk: Int32

conflict_with

conflict_with: Set<AnchorLogootNode> = new Set<AnchorLogootNode>()

Readonly equal_nodes

equal_nodes: AnchorLogootNode[] = []

Optional left_anchor

left_anchor: LeftAnchor

Optional left_node

left_node: AnchorLogootNode

length

length: number

logoot_start

logoot_start: LogootPosition

Optional parent_node

parent_node: AnchorLogootNode

Optional right_anchor

right_anchor: RightAnchor

Optional right_node

right_node: AnchorLogootNode

type

type: NodeType

value

value: number

Accessors

absolute_value

  • get absolute_value(): number
  • The actual value of this node. The value member only stores the value relative to the parent node.

    Returns number

equal_parent

inorder_predecessor

inorder_successor

largest_child

largest_larger_child

ldoc_end

  • get ldoc_end(): number

ldoc_length

  • get ldoc_length(): number

ldoc_start

  • get ldoc_start(): number

logoot_end

root

smallest_child

smallest_smaller_child

true_left

true_right

Methods

addChild

  • Called by the BST only. DO NOT use. This is only public because JS has no concept of C++ friend classes and I need to use this function in unit tests. Call the add function on the BST object instead.

    Parameters

    Returns void

addConflictsFromNode

addSpaceBefore

  • Applies an offset to the node's starting position. This will offset all nodes after this one efficiently. There's just one catch: This may not change the order of the BST. No errors will be thrown (or can, efficiently at least), so just make sure your code doesn't change the order. This will not mutate the BST unless the position of a node becomes equal to that of another node. In that case, the BST will be re-arranged so that the equal nodes form a linked list under the left side of the root equal node as required.

    Parameters

    • s: number

      The offset to apply to this node's start. This may be positive to add space before or negative to remove space before.

    • Default value rootUpdate: (np: AnchorLogootNode) => void = noRootUpdateFunction

      A function that will be called if the BST root needs to be updated. A TypeError will be thrown if one is not provided.

    Returns void

findLeftAnchorNode

findRightAnchorNode

operateOnAll

positionOf

predecessorIterator

prefSearch

preferential_cmp

reduceLeft

reduceRight

remove

  • Removes this node from the BST. The node's absolute_value will be preserved, so it can be directly re-added to the BST.

    Parameters

    • Optional rootUpdate: (np: AnchorLogootNode) => void

      This function is called if the bst_root of the BST must be updated. Normally, it should be given the value of (node) => (bst.bst_root = node). If no value is provided, an error will be thrown if an update is attempted. For this reason, if you expect that no root update will be required for whatever reason, do not provide a value. This will ensure that an error is thrown and a potential bug is caught.

    Returns void

removeChild

replaceWith

  • THIS IS NOT INTENDED FOR OUTSIDE USE! It is not protected for the unit tests that rely on it.

    Replaces this node with another node. This is used internally by the remove function. If the node provided has a parent, it will be removed from the parent. WARNING: If the provided node's current children conflict with the children of the destination node, the destination node's children have priority.

    Parameters

    • data: AnchorLogootNode

      New node

    • Default value rootUpdate: (np: AnchorLogootNode) => void = noRootUpdateFunction

      A function that will be called if the BST root needs to be updated. A TypeError will be thrown if one is not provided.

    • Default value value: number = data?.absolute_value

      The value to use for the new node. It defaults to the node's absolute_value.

    Returns AnchorLogootNode

search

selfTest

selfTestEqual

splitAround

successorIterator

toDeepString

  • toDeepString(): string
  • Creates a virtual tree showing right, left, and equal nodes. Very useful when debugging BST issues.

    Returns string

toString

  • toString(short?: boolean): string

updateNeighborConflicts

  • Infers a node's conflicts from its neighbors. This assumes that the neighbors have the correct conflict_with. This will only add conflicts that the neighbors are in or create.

    Parameters

    Returns boolean

Generated using TypeDoc