11 instantiations of Node
System.Collections (11)
System\Collections\Generic\SortedSet.cs (11)
308
root = new
Node
(item, NodeColor.Black);
357
Node node = new
Node
(item, NodeColor.Red);
948
root = new
Node
(arr[startIndex], NodeColor.Black);
955
root = new
Node
(arr[startIndex], NodeColor.Black);
956
root.Right = new
Node
(arr[endIndex], NodeColor.Black);
964
root = new
Node
(arr[startIndex + 1], NodeColor.Black);
965
root.Left = new
Node
(arr[startIndex], NodeColor.Black);
966
root.Right = new
Node
(arr[endIndex], NodeColor.Black);
974
root = new
Node
(arr[midpt], NodeColor.Black);
977
ConstructRootFromSortedArray(arr, midpt + 2, endIndex, new
Node
(arr[midpt + 1], NodeColor.Red)) :
1687
public Node ShallowClone() => new
Node
(Item, Color);
107 references to Node
System.Collections (107)
System\Collections\Generic\SortedDictionary.cs (11)
66
TreeSet<KeyValuePair<TKey, TValue>>.
Node
? node = _set.FindNode(keyValuePair);
84
TreeSet<KeyValuePair<TKey, TValue>>.
Node
? node = _set.FindNode(keyValuePair);
112
TreeSet<KeyValuePair<TKey, TValue>>.
Node
? node = _set.FindNode(new KeyValuePair<TKey, TValue>(key, default(TValue)!));
124
TreeSet<KeyValuePair<TKey, TValue>>.
Node
? node = _set.FindNode(new KeyValuePair<TKey, TValue>(key, default(TValue)!));
213
_set.InOrderTreeWalk(delegate (TreeSet<KeyValuePair<TKey, TValue>>.
Node
node)
226
_set.InOrderTreeWalk(delegate (TreeSet<KeyValuePair<TKey, TValue>>.
Node
node)
261
TreeSet<KeyValuePair<TKey, TValue>>.
Node
? node = _set.FindNode(new KeyValuePair<TKey, TValue>(key, default(TValue)!));
547
_dictionary._set.InOrderTreeWalk(delegate (TreeSet<KeyValuePair<TKey, TValue>>.
Node
node) { array[index++] = node.Item.Key; return true; });
580
_dictionary._set.InOrderTreeWalk(delegate (TreeSet<KeyValuePair<TKey, TValue>>.
Node
node) { objects[index++] = node.Item.Key; return true; });
708
_dictionary._set.InOrderTreeWalk(delegate (TreeSet<KeyValuePair<TKey, TValue>>.
Node
node) { array[index++] = node.Item.Value; return true; });
741
_dictionary._set.InOrderTreeWalk(delegate (TreeSet<KeyValuePair<TKey, TValue>>.
Node
node) { objects[index++] = node.Item.Value; return true; });
System\Collections\Generic\SortedSet.cs (86)
35
internal delegate bool TreeWalkPredicate<T>(SortedSet<T>.
Node
node);
53
private
Node
? root;
194
var stack = new Stack<
Node
>(2 * (int)Log2(Count + 1));
195
Node
? current = root;
211
Node
? node = current.Right;
237
var processQueue = new Queue<
Node
>();
240
Node
current;
317
Node
? current = root;
318
Node
? parent = null;
319
Node
? grandParent = null;
320
Node
? greatGrandParent = null;
343
if (
Node
.IsNonNullRed(parent))
357
Node
node = new Node(item, NodeColor.Red);
400
Node
? current = root;
401
Node
? parent = null;
402
Node
? grandParent = null;
403
Node
? match = null;
404
Node
? parentOfMatch = null;
418
Node
sibling = parent.GetSibling(current);
448
Debug.Assert(
Node
.IsNonNullBlack(sibling));
458
Node
newGrandParent = parent.Rotate(parent.GetRotation(current, sibling))!;
607
private void InsertionBalance(
Node
current, ref
Node
parent,
Node
grandParent,
Node
greatGrandParent)
615
Node
newChildOfGreatGrandParent;
642
private void ReplaceChildOrRoot(
Node
? parent,
Node
child,
Node
newChild)
657
private void ReplaceNode(
Node
match,
Node
parentOfMatch,
Node
successor,
Node
parentOfSuccessor)
693
internal virtual
Node
? FindNode(T item)
695
Node
? current = root;
726
Node
? current = root;
743
internal
Node
? FindRange(T? from, T? to) => FindRange(from, to, lowerBoundActive: true, upperBoundActive: true);
745
internal
Node
? FindRange(T? from, T? to, bool lowerBoundActive, bool upperBoundActive)
747
Node
? current = root;
920
private static
Node
? ConstructRootFromSortedArray(T[] arr, int startIndex, int endIndex,
Node
? redNode)
941
Node
root;
1471
Node
current = root;
1492
Node
current = root;
1602
public static bool IsNonNullBlack(
Node
? node) => node != null && node.IsBlack;
1604
public static bool IsNonNullRed(
Node
? node) => node != null && node.IsRed;
1606
public static bool IsNullOrBlack(
Node
? node) => node == null || node.IsBlack;
1610
public
Node
? Left { get; set; }
1612
public
Node
? Right { get; set; }
1628
public
Node
DeepClone(int count)
1633
Node
newRoot = ShallowClone();
1635
var pendingNodes = new Stack<(
Node
source,
Node
target)>(2 * Log2(count) + 2);
1640
Node
clonedNode;
1642
if (next.source.Left is
Node
left)
1649
if (next.source.Right is
Node
right)
1663
public TreeRotation GetRotation(
Node
current,
Node
sibling)
1679
public
Node
GetSibling(
Node
node)
1687
public
Node
ShallowClone() => new Node(Item, Color);
1702
public
Node
? Rotate(TreeRotation rotation)
1704
Node
removeRed;
1732
public
Node
RotateLeft()
1734
Node
child = Right!;
1743
public
Node
RotateLeftRight()
1745
Node
child = Left!;
1746
Node
grandChild = child.Right!;
1758
public
Node
RotateRight()
1760
Node
child = Left!;
1769
public
Node
RotateRightLeft()
1771
Node
child = Right!;
1772
Node
grandChild = child.Left!;
1801
public void ReplaceChild(
Node
child,
Node
newChild)
1820
private bool HasChild(
Node
child) => child == Left || child == Right;
1822
private bool HasChildren(
Node
child1,
Node
child2)
1837
private readonly Stack<
Node
> _stack;
1838
private
Node
? _current;
1854
_stack = new Stack<
Node
>(2 * (int)Log2(set.TotalCount() + 1));
1874
Node
? node = _tree.root;
1875
Node
? next, other;
1913
Node
? node = (_reverse ? _current.Left : _current.Right);
1914
Node
? next, other;
2003
Node
? node = FindNode(equalValue);
System\Collections\Generic\SortedSet.TreeSubSet.cs (10)
129
Node
? current = root;
160
Node
? current = root;
196
Stack<
Node
> stack = new Stack<
Node
>(2 * (int)SortedSet<T>.Log2(count + 1)); // this is not exactly right if count is out of date, but the stack can grow
197
Node
? current = root;
223
Node
? node = current.Right;
253
Queue<
Node
> processQueue = new Queue<
Node
>();
255
Node
current;
276
internal override SortedSet<T>.
Node
? FindNode(T item)