Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public abstract class SizeBalancedTreeMethods<TElement> : SizedBinaryTreeMethods
protected int attachCount = 0;
const int maintainThreashold = 1;

/// <summary>
/// <para>
/// Executes actions before attaching a node to the tree.
/// </para>
/// <para></para>
/// </summary>
protected override void BeforeAttach()
{
attachCount++;
Expand Down Expand Up @@ -65,6 +71,12 @@ protected override void AttachCore(ref TElement root, TElement node)
}
}

/// <summary>
/// <para>
/// Executes actions after attaching a node to the tree.
/// </para>
/// <para></para>
/// </summary>
protected override void AfterAttach()
{
if (attachCount > maintainThreashold)
Expand Down Expand Up @@ -156,6 +168,16 @@ protected override void DetachCore(ref TElement root, TElement nodeToDetach)
ClearNode(nodeToDetach);
}

/// <summary>
/// <para>
/// Maintains the balance of the left subtree to ensure size-balanced tree properties.
/// </para>
/// <para></para>
/// </summary>
/// <param name="root">
/// <para>The root.</para>
/// <para></para>
/// </param>
private void LeftMaintain(ref TElement root)
{
if (root != TElement.Zero)
Expand Down Expand Up @@ -193,6 +215,16 @@ private void LeftMaintain(ref TElement root)
}
}

/// <summary>
/// <para>
/// Maintains the balance of the right subtree to ensure size-balanced tree properties.
/// </para>
/// <para></para>
/// </summary>
/// <param name="root">
/// <para>The root.</para>
/// <para></para>
/// </param>
private void RightMaintain(ref TElement root)
{
if (root != TElement.Zero)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace Platform.Collections.Methods.Trees
/// </para>
/// <para></para>
/// </summary>
/// <seealso cref="GenericCollectionMethodsBase{TElement}"/>
public abstract class SizedBinaryTreeMethodsBase<TElement> where TElement: IUnsignedNumber<TElement>, IComparisonOperators<TElement, TElement, bool>
{
/// <summary>
Expand Down
Loading