4 instantiations of Node
System.Collections.Immutable (4)
System\Collections\Immutable\ImmutableSortedSet_1.Node.cs (4)
21
internal static readonly Node EmptyNode = new
Node
();
346
return new
Node
(key, this, this);
736
return new
Node
(items[start + leftCount], left, right, true);
751
return new
Node
(_key, left ?? _left, right ?? _right);
85 references to Node
System.Collections.Immutable (85)
System\Collections\Immutable\ImmutableSortedSet_1.Builder.cs (9)
36
private ImmutableSortedSet<T>.
Node
_root = ImmutableSortedSet<T>.
Node
.EmptyNode;
155
ImmutableSortedSet<T>.
Node
newRoot =
Node
.EmptyNode;
180
private
Node
Root
241
ImmutableSortedSet<T>.
Node
result = ImmutableSortedSet<T>.
Node
.EmptyNode;
352
this.Root = ImmutableSortedSet<T>.
Node
.EmptyNode;
470
Node
searchResult = _root.Search(equalValue, _comparer);
System\Collections\Immutable\ImmutableSortedSet_1.cs (16)
44
private readonly
Node
_root;
57
_root =
Node
.EmptyNode;
66
private ImmutableSortedSet(
Node
root, IComparer<T> comparer)
206
Node
searchResult = _root.Search(equalValue, _comparer);
246
ImmutableSortedSet<T>.
Node
result = _root;
357
var result = new ImmutableSortedSet<T>(
Node
.EmptyNode, comparer);
1025
private static ImmutableSortedSet<T> Wrap(
Node
root, IComparer<T> comparer)
1049
ImmutableSortedSet<T>.
Node
result = _root;
1073
ImmutableSortedSet<T>.
Node
result = _root;
1087
private ImmutableSortedSet<T> Wrap(
Node
root)
1160
Node
root =
Node
.NodeTreeFromList(list.AsReadOnlyList(), 0, list.Count);
1218
Node
root =
Node
.NodeTreeFromList(list.AsReadOnlyList(), 0, list.Count);
1230
private readonly
Node
_root;
1236
internal ReverseEnumerable(
Node
root)
System\Collections\Immutable\ImmutableSortedSet_1.Enumerator.cs (15)
46
private
Node
_root;
59
private SecurePooledObject<Stack<RefAsValueType<
Node
>>>? _stack;
64
private
Node
? _current;
77
internal Enumerator(
Node
root, Builder? builder = null, bool reverse = false)
88
if (!SecureObjectPool<Stack<RefAsValueType<
Node
>>, Enumerator>.TryTake(this, out _stack))
90
_stack = SecureObjectPool<Stack<RefAsValueType<
Node
>>, Enumerator>.PrepNew(this, new Stack<RefAsValueType<
Node
>>(root.Height));
134
if (_stack != null && _stack.TryUse(ref this, out Stack<RefAsValueType<
Node
>>? stack))
137
SecureObjectPool<Stack<RefAsValueType<
Node
>>, Enumerator>.TryAdd(this, _stack!);
151
Stack<RefAsValueType<ImmutableSortedSet<T>.
Node
>> stack = _stack!.Use(ref this);
154
Node
n = stack.Pop().Value;
175
Stack<RefAsValueType<ImmutableSortedSet<T>.
Node
>> stack = _stack!.Use(ref this);
213
private void PushNext(
Node
node)
216
Stack<RefAsValueType<ImmutableSortedSet<T>.
Node
>> stack = _stack!.Use(ref this);
219
stack.Push(new RefAsValueType<
Node
>(node));
System\Collections\Immutable\ImmutableSortedSet_1.Node.cs (45)
21
internal static readonly
Node
EmptyNode = new Node();
56
private
Node
? _left;
61
private
Node
? _right;
64
/// Initializes a new instance of the <see cref="ImmutableSortedSet{T}.
Node
"/> class
74
/// Initializes a new instance of the <see cref="ImmutableSortedSet{T}.
Node
"/> class
81
private Node(T key,
Node
left,
Node
right, bool frozen = false)
117
public
Node
? Left
125
public
Node
? Right
164
Node
n = this;
187
Node
n = this;
339
internal
Node
Add(T key, IComparer<T> comparer, out bool mutated)
350
Node
result = this;
354
ImmutableSortedSet<T>.
Node
newRight = _right!.Add(key, comparer, out mutated);
362
ImmutableSortedSet<T>.
Node
newLeft = _left!.Add(key, comparer, out mutated);
385
internal
Node
Remove(T key, IComparer<T> comparer, out bool mutated)
397
Node
result = this;
423
ImmutableSortedSet<T>.
Node
successor = _right;
429
ImmutableSortedSet<T>.
Node
newRight = _right.Remove(successor._key, comparer, out _);
435
ImmutableSortedSet<T>.
Node
newLeft = _left.Remove(key, comparer, out mutated);
443
ImmutableSortedSet<T>.
Node
newRight = _right.Remove(key, comparer, out mutated);
489
internal
Node
Search(T key, IComparer<T> comparer)
581
private static
Node
RotateLeft(
Node
tree)
591
ImmutableSortedSet<T>.
Node
right = tree._right;
600
private static
Node
RotateRight(
Node
tree)
610
ImmutableSortedSet<T>.
Node
left = tree._left;
619
private static
Node
DoubleLeft(
Node
tree)
629
Node
rotatedRightChild = tree.Mutate(right: RotateRight(tree._right));
638
private static
Node
DoubleRight(
Node
tree)
648
Node
rotatedLeftChild = tree.Mutate(left: RotateLeft(tree._left));
657
private static int Balance(
Node
tree)
672
private static bool IsRightHeavy(
Node
tree)
682
private static bool IsLeftHeavy(
Node
tree)
694
private static
Node
MakeBalanced(
Node
tree)
721
internal static
Node
NodeTreeFromList(IReadOnlyList<T> items, int start, int length)
734
Node
left = NodeTreeFromList(items, start, leftCount);
735
Node
right = NodeTreeFromList(items, start + leftCount + 1, rightCount);
746
private
Node
Mutate(
Node
? left = null,
Node
? right = null)