Class SizedAndThreadedAVLBalancedTreeMethods<TElement>
- Namespace
- Platform.Collections.Methods.Trees
- Assembly
- Platform.Collections.Methods.dll
Combination of Size, Height (AVL), and threads.
public abstract class SizedAndThreadedAVLBalancedTreeMethods<TElement> : SizedBinaryTreeMethodsBase<TElement> where TElement : IUnsignedNumber<TElement>, IComparisonOperators<TElement, TElement, bool>
Type Parameters
TElement
- Inheritance
-
SizedBinaryTreeMethodsBase<TElement>SizedAndThreadedAVLBalancedTreeMethods<TElement>
- Inherited Members
Remarks
Based on: TreeLib.AVLTreeList. Which itself based on: GNOME/glib/gtree. The path buffer belongs to the instance, so one instance must not be used by several threads at once.
Methods
AttachCore(ref TElement, TElement)
Attaches the core using the specified root.
protected override void AttachCore(ref TElement root, TElement node)
Parameters
rootTElementThe root.
nodeTElementThe node.
Exceptions
- InvalidOperationException
Node with the same key already attached to a tree.
ClearNode(TElement)
Clears the node using the specified node.
protected override void ClearNode(TElement node)
Parameters
nodeTElementThe node.
Contains(TElement, TElement)
Determines whether this instance contains.
public override bool Contains(TElement node, TElement root)
Parameters
nodeTElementThe node.
rootTElementThe root.
Returns
- bool
The bool
DecrementBalance(TElement)
Decrements the balance using the specified node.
protected void DecrementBalance(TElement node)
Parameters
nodeTElementThe node.
DetachCore(ref TElement, TElement)
Detaches the core using the specified root.
protected override void DetachCore(ref TElement root, TElement node)
Parameters
rootTElementThe root.
nodeTElementThe node.
Exceptions
- InvalidOperationException
Cannot find a node.
- InvalidOperationException
Cannot find a node.
GetBalance(TElement)
Gets the balance using the specified node.
protected abstract sbyte GetBalance(TElement node)
Parameters
nodeTElementThe node.
Returns
- sbyte
The sbyte
GetLeftIsChild(TElement)
Determines whether this instance get left is child.
protected abstract bool GetLeftIsChild(TElement node)
Parameters
nodeTElementThe node.
Returns
- bool
The bool
GetLeftOrDefault(TElement)
Gets the left or default using the specified node.
protected override TElement GetLeftOrDefault(TElement node)
Parameters
nodeTElementThe node.
Returns
- TElement
The element
GetLeftest(TElement)
Gets the leftest using the specified current.
protected override TElement GetLeftest(TElement current)
Parameters
currentTElementThe current.
Returns
- TElement
The current.
GetNext(TElement)
Gets the next using the specified node.
protected override TElement GetNext(TElement node)
Parameters
nodeTElementThe node.
Returns
- TElement
The current.
GetPrevious(TElement)
Gets the previous using the specified node.
protected override TElement GetPrevious(TElement node)
Parameters
nodeTElementThe node.
Returns
- TElement
The current.
GetRightIsChild(TElement)
Determines whether this instance get right is child.
protected abstract bool GetRightIsChild(TElement node)
Parameters
nodeTElementThe node.
Returns
- bool
The bool
GetRightOrDefault(TElement)
Gets the right or default using the specified node.
protected override TElement GetRightOrDefault(TElement node)
Parameters
nodeTElementThe node.
Returns
- TElement
The element
GetRightest(TElement)
Gets the rightest using the specified current.
protected override TElement GetRightest(TElement current)
Parameters
currentTElementThe current.
Returns
- TElement
The current.
IncrementBalance(TElement)
Increments the balance using the specified node.
protected void IncrementBalance(TElement node)
Parameters
nodeTElementThe node.
LeftRotateWithBalance(TElement)
Lefts the rotate with balance using the specified node.
protected TElement LeftRotateWithBalance(TElement node)
Parameters
nodeTElementThe node.
Returns
- TElement
The element
PrintNode(TElement, StringBuilder, int)
Prints the node using the specified node.
protected override void PrintNode(TElement node, StringBuilder sb, int level)
Parameters
nodeTElementThe node.
sbStringBuilderThe string builder.
levelintThe level.
RightRotateWithBalance(TElement)
Rights the rotate with balance using the specified node.
protected TElement RightRotateWithBalance(TElement node)
Parameters
nodeTElementThe node.
Returns
- TElement
The element
SetBalance(TElement, sbyte)
Sets the balance using the specified node.
protected abstract void SetBalance(TElement node, sbyte value)
Parameters
nodeTElementThe node.
valuesbyteThe value.
SetLeftIsChild(TElement, bool)
Sets the left is child using the specified node.
protected abstract void SetLeftIsChild(TElement node, bool value)
Parameters
nodeTElementThe node.
valueboolThe value.
SetRightIsChild(TElement, bool)
Sets the right is child using the specified node.
protected abstract void SetRightIsChild(TElement node, bool value)
Parameters
nodeTElementThe node.
valueboolThe value.