Skip to content

Commit

Permalink
Fix red interface to not expose the green node.
Browse files Browse the repository at this point in the history
  • Loading branch information
GGG-KILLER committed Jan 29, 2024
1 parent 17612b0 commit 7e07b4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
25 changes: 3 additions & 22 deletions Tsu.Trees.RedGreen/src/IRedNode.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using Tsu.Trees.RedGreen.Internal;

Expand All @@ -7,29 +6,21 @@ namespace Tsu.Trees.RedGreen;
/// <summary>
/// Base interface for a red tree node.
/// </summary>
/// <typeparam name="TGreenRoot"></typeparam>
/// <typeparam name="TRedRoot"></typeparam>
/// <typeparam name="TKind"></typeparam>
public interface IRedNode<TGreenRoot, TRedRoot, TKind>
where TGreenRoot : class, IGreenNode<TGreenRoot, TRedRoot, TKind>
where TRedRoot : class, IRedNode<TGreenRoot, TRedRoot, TKind>
public interface IRedNode<TRedRoot, TKind>
where TRedRoot : class, IRedNode<TRedRoot, TKind>
where TKind : Enum
{
/// <summary>
/// The kind of this node.
/// </summary>
TKind Kind { get; }

#pragma warning disable CS1591
// Intentionally undocumented so people don't use it.
[EditorBrowsable(EditorBrowsableState.Never)]
TGreenRoot Green { get; }
#pragma warning restore

/// <summary>
/// This node's parent.
/// </summary>
TGreenRoot? Parent { get; }
TRedRoot? Parent { get; }

/// <summary>
/// Checks whether the current node is structurally equivalent to another.
Expand All @@ -46,16 +37,6 @@ public interface IRedNode<TGreenRoot, TRedRoot, TKind>
/// <returns></returns>
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

/// <summary>
/// Gets a list of the child nodes in prefix document order.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Tsu.Trees.RedGreen/src/Internal/IGreenNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Tsu.Trees.RedGreen.Internal;
[EditorBrowsable(EditorBrowsableState.Never)]
public interface IGreenNode<TGreenRoot, TRedRoot, TKind>
where TGreenRoot : class, IGreenNode<TGreenRoot, TRedRoot, TKind>
where TRedRoot : class, IRedNode<TGreenRoot, TRedRoot, TKind>
where TRedRoot : class, IRedNode<TRedRoot, TKind>
where TKind : Enum
{
/// <summary>
Expand Down

0 comments on commit 7e07b4a

Please sign in to comment.