diff --git a/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksAvlBalancedTreeMethodsBase.cs b/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksAvlBalancedTreeMethodsBase.cs index 203692dcf..0163aade5 100644 --- a/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksAvlBalancedTreeMethodsBase.cs +++ b/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksAvlBalancedTreeMethodsBase.cs @@ -521,6 +521,29 @@ protected virtual bool GetLeftIsChildValue(TLinkAddress value) //return Bit.PartialRead(value != 4, 1, default); } + /// + /// + /// Determines whether the left child of a node is a child (not a thread) using size comparison. + /// + /// + /// + /// + /// The node. + /// + /// + /// + /// The bool + /// + /// + [MethodImpl(methodImplOptions: MethodImplOptions.AggressiveInlining)] + protected virtual bool GetLeftIsChildBySizeComparison(TLinkAddress node) + { + var nodeSize = GetSize(node); + var left = GetLeft(node); + var leftSize = GetSizeOrZero(left); + return leftSize > TLinkAddress.Zero && nodeSize > leftSize; + } + /// /// /// Sets the left is child value using the specified stored value. @@ -567,6 +590,29 @@ protected virtual bool GetRightIsChildValue(TLinkAddress value) //return Bit.PartialRead(value != 3, 1, default); } + /// + /// + /// Determines whether the right child of a node is a child (not a thread) using size comparison. + /// + /// + /// + /// + /// The node. + /// + /// + /// + /// The bool + /// + /// + [MethodImpl(methodImplOptions: MethodImplOptions.AggressiveInlining)] + protected virtual bool GetRightIsChildBySizeComparison(TLinkAddress node) + { + var nodeSize = GetSize(node); + var right = GetRight(node); + var rightSize = GetSizeOrZero(right); + return rightSize > TLinkAddress.Zero && nodeSize > rightSize; + } + /// /// /// Sets the right is child value using the specified stored value. diff --git a/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksSourcesAvlBalancedTreeMethods.cs b/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksSourcesAvlBalancedTreeMethods.cs index 967027a9a..9d5435cb7 100644 --- a/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksSourcesAvlBalancedTreeMethods.cs +++ b/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksSourcesAvlBalancedTreeMethods.cs @@ -173,7 +173,7 @@ public LinksSourcesAvlBalancedTreeMethods(LinksConstants constants /// /// - /// Determines whether this instance get left is child. + /// Determines whether this instance get left is child using size comparison. /// /// /// @@ -186,7 +186,7 @@ public LinksSourcesAvlBalancedTreeMethods(LinksConstants constants /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected override bool GetLeftIsChild(TLinkAddress node) => GetLeftIsChildValue(GetLinkReference(node).SizeAsSource); + protected override bool GetLeftIsChild(TLinkAddress node) => GetLeftIsChildBySizeComparison(node); /// /// @@ -207,7 +207,7 @@ public LinksSourcesAvlBalancedTreeMethods(LinksConstants constants /// /// - /// Determines whether this instance get right is child. + /// Determines whether this instance get right is child using size comparison. /// /// /// @@ -220,7 +220,7 @@ public LinksSourcesAvlBalancedTreeMethods(LinksConstants constants /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected override bool GetRightIsChild(TLinkAddress node) => GetRightIsChildValue(GetLinkReference(node).SizeAsSource); + protected override bool GetRightIsChild(TLinkAddress node) => GetRightIsChildBySizeComparison(node); /// /// diff --git a/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksTargetsAvlBalancedTreeMethods.cs b/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksTargetsAvlBalancedTreeMethods.cs index deb9cdb5c..25d635b41 100644 --- a/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksTargetsAvlBalancedTreeMethods.cs +++ b/csharp/Platform.Data.Doublets/Memory/United/Generic/LinksTargetsAvlBalancedTreeMethods.cs @@ -173,7 +173,7 @@ public LinksTargetsAvlBalancedTreeMethods(LinksConstants constants /// /// - /// Determines whether this instance get left is child. + /// Determines whether this instance get left is child using size comparison. /// /// /// @@ -186,7 +186,7 @@ public LinksTargetsAvlBalancedTreeMethods(LinksConstants constants /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected override bool GetLeftIsChild(TLinkAddress node) => GetLeftIsChildValue(GetLinkReference(node).SizeAsTarget); + protected override bool GetLeftIsChild(TLinkAddress node) => GetLeftIsChildBySizeComparison(node); /// /// @@ -207,7 +207,7 @@ public LinksTargetsAvlBalancedTreeMethods(LinksConstants constants /// /// - /// Determines whether this instance get right is child. + /// Determines whether this instance get right is child using size comparison. /// /// /// @@ -220,7 +220,7 @@ public LinksTargetsAvlBalancedTreeMethods(LinksConstants constants /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected override bool GetRightIsChild(TLinkAddress node) => GetRightIsChildValue(GetLinkReference(node).SizeAsTarget); + protected override bool GetRightIsChild(TLinkAddress node) => GetRightIsChildBySizeComparison(node); /// ///