From 7e07b4a10642accec56af1c342e03ccbd6c0a5d2 Mon Sep 17 00:00:00 2001 From: GGG Date: Mon, 29 Jan 2024 01:28:43 -0300 Subject: [PATCH] Fix red interface to not expose the green node. --- Tsu.Trees.RedGreen/src/IRedNode.cs | 25 +++---------------- Tsu.Trees.RedGreen/src/Internal/IGreenNode.cs | 2 +- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/Tsu.Trees.RedGreen/src/IRedNode.cs b/Tsu.Trees.RedGreen/src/IRedNode.cs index 8825695..ce8ce3c 100644 --- a/Tsu.Trees.RedGreen/src/IRedNode.cs +++ b/Tsu.Trees.RedGreen/src/IRedNode.cs @@ -1,4 +1,3 @@ -using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using Tsu.Trees.RedGreen.Internal; @@ -7,12 +6,10 @@ namespace Tsu.Trees.RedGreen; /// /// Base interface for a red tree node. /// -/// /// /// -public interface IRedNode - where TGreenRoot : class, IGreenNode - where TRedRoot : class, IRedNode +public interface IRedNode + where TRedRoot : class, IRedNode where TKind : Enum { /// @@ -20,16 +17,10 @@ public interface IRedNode /// TKind Kind { get; } -#pragma warning disable CS1591 - // Intentionally undocumented so people don't use it. - [EditorBrowsable(EditorBrowsableState.Never)] - TGreenRoot Green { get; } -#pragma warning restore - /// /// This node's parent. /// - TGreenRoot? Parent { get; } + TRedRoot? Parent { get; } /// /// Checks whether the current node is structurally equivalent to another. @@ -46,16 +37,6 @@ public interface IRedNode /// bool Contains(TRedRoot other); -#pragma warning disable CS1591 - // Intentionally left undocumented to discourage usage. - [EditorBrowsable(EditorBrowsableState.Never)] - TRedRoot? GetNodeSlot(int slot); - - // Intentionally left undocumented to discourage usage. - [EditorBrowsable(EditorBrowsableState.Never)] - TRedRoot GetRequiredNodeSlot(int slot); -#pragma warning disable - /// /// Gets a list of the child nodes in prefix document order. /// diff --git a/Tsu.Trees.RedGreen/src/Internal/IGreenNode.cs b/Tsu.Trees.RedGreen/src/Internal/IGreenNode.cs index 4e14309..d814585 100644 --- a/Tsu.Trees.RedGreen/src/Internal/IGreenNode.cs +++ b/Tsu.Trees.RedGreen/src/Internal/IGreenNode.cs @@ -29,7 +29,7 @@ namespace Tsu.Trees.RedGreen.Internal; [EditorBrowsable(EditorBrowsableState.Never)] public interface IGreenNode where TGreenRoot : class, IGreenNode - where TRedRoot : class, IRedNode + where TRedRoot : class, IRedNode where TKind : Enum { ///