5 instantiations of Node
System.Collections.Immutable (5)
System\Collections\Immutable\ImmutableSortedDictionary_2.Node.cs (5)
22internal static readonly Node EmptyNode = new Node(); 605return new Node(item.Key, item.Value, left, right, true); 628return new Node(key, value, this, this); 661result = new Node(key, value, _left!, _right!); 760return new Node(_key, _value, left ?? _left, right ?? _right);
88 references to Node
System.Collections.Immutable (88)
System\Collections\Immutable\ImmutableSortedDictionary_2.Builder.cs (6)
34private Node _root = Node.EmptyNode; 145private Node Root 306ImmutableSortedDictionary<TKey, TValue>.Node newRoot = Node.EmptyNode; 493this.Root = ImmutableSortedDictionary<TKey, TValue>.Node.EmptyNode;
System\Collections\Immutable\ImmutableSortedDictionary_2.cs (15)
29private readonly Node _root; 55_root = Node.EmptyNode; 65private ImmutableSortedDictionary(Node root, int count, IComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer) 248ImmutableSortedDictionary<TKey, TValue>.Node result = _root.Add(key, value, _keyComparer, _valueComparer, out _); 259ImmutableSortedDictionary<TKey, TValue>.Node result = _root.SetItem(key, value, _keyComparer, _valueComparer, out replacedExistingValue, out _); 291ImmutableSortedDictionary<TKey, TValue>.Node result = _root.Remove(value, _keyComparer, out _); 302ImmutableSortedDictionary<TKey, TValue>.Node result = _root; 307ImmutableSortedDictionary<TKey, TValue>.Node newResult = result.Remove(key, _keyComparer, out mutated); 343var result = new ImmutableSortedDictionary<TKey, TValue>(Node.EmptyNode, 0, keyComparer, valueComparer); 739private static ImmutableSortedDictionary<TKey, TValue> Wrap(Node root, int count, IComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer) 788ImmutableSortedDictionary<TKey, TValue>.Node result = _root; 794ImmutableSortedDictionary<TKey, TValue>.Node newResult = overwriteOnCollision 816private ImmutableSortedDictionary<TKey, TValue> Wrap(Node root, int adjustedCountIfDifferentRoot) 881Node root = Node.NodeTreeFromSortedDictionary(dictionary);
System\Collections\Immutable\ImmutableSortedDictionary_2.Enumerator.cs (15)
42private Node _root; 47private SecurePooledObject<Stack<RefAsValueType<Node>>>? _stack; 52private Node? _current; 64internal Enumerator(Node root, Builder? builder = null) 76if (!SecureObjectPool<Stack<RefAsValueType<Node>>, Enumerator>.TryTake(this, out _stack)) 78_stack = SecureObjectPool<Stack<RefAsValueType<Node>>, Enumerator>.PrepNew(this, new Stack<RefAsValueType<Node>>(root.Height)); 123if (_stack != null && _stack.TryUse(ref this, out Stack<RefAsValueType<Node>>? stack)) 126SecureObjectPool<Stack<RefAsValueType<Node>>, Enumerator>.TryAdd(this, _stack!); 143Stack<RefAsValueType<ImmutableSortedDictionary<TKey, TValue>.Node>> stack = _stack.Use(ref this); 146Node n = stack.Pop().Value; 168Stack<RefAsValueType<ImmutableSortedDictionary<TKey, TValue>.Node>> stack = _stack.Use(ref this); 207private void PushLeft(Node node) 211Stack<RefAsValueType<ImmutableSortedDictionary<TKey, TValue>.Node>> stack = _stack.Use(ref this); 214stack.Push(new RefAsValueType<Node>(node));
System\Collections\Immutable\ImmutableSortedDictionary_2.Node.cs (51)
22internal static readonly Node EmptyNode = new Node(); 51private Node? _left; 56private Node? _right; 59/// Initializes a new instance of the <see cref="ImmutableSortedDictionary{TKey, TValue}.Node"/> class 69/// Initializes a new instance of the <see cref="ImmutableSortedDictionary{TKey, TValue}.Node"/> class 77private Node(TKey key, TValue value, Node left, Node right, bool frozen = false) 116public Node? Left { get { return _left; } } 121public Node? Right { get { return _right; } } 231internal static Node NodeTreeFromSortedDictionary(SortedDictionary<TKey, TValue> dictionary) 247internal Node Add(TKey key, TValue value, IComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer, out bool mutated) 265internal Node SetItem(TKey key, TValue value, IComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer, out bool replacedExistingValue, out bool mutated) 281internal Node Remove(TKey key, IComparer<TKey> keyComparer, out bool mutated) 298ImmutableSortedDictionary<TKey, TValue>.Node match = this.Search(key, keyComparer); 319ImmutableSortedDictionary<TKey, TValue>.Node match = this.Search(key, keyComparer); 350ImmutableSortedDictionary<TKey, TValue>.Node match = this.Search(equalKey, keyComparer); 419ImmutableSortedDictionary<TKey, TValue>.Node matchingNode = this.Search(pair.Key, keyComparer); 449private static Node RotateLeft(Node tree) 459ImmutableSortedDictionary<TKey, TValue>.Node right = tree._right; 468private static Node RotateRight(Node tree) 478ImmutableSortedDictionary<TKey, TValue>.Node left = tree._left; 487private static Node DoubleLeft(Node tree) 497Node rotatedRightChild = tree.Mutate(right: RotateRight(tree._right)); 506private static Node DoubleRight(Node tree) 516Node rotatedLeftChild = tree.Mutate(left: RotateLeft(tree._left)); 525private static int Balance(Node tree) 540private static bool IsRightHeavy(Node tree) 550private static bool IsLeftHeavy(Node tree) 562private static Node MakeBalanced(Node tree) 589private static Node NodeTreeFromList(IReadOnlyList<KeyValuePair<TKey, TValue>> items, int start, int length) 602Node left = NodeTreeFromList(items, start, leftCount); 603Node right = NodeTreeFromList(items, start + leftCount + 1, rightCount); 619private Node SetOrAdd(TKey key, TValue value, IComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer, bool overwriteExistingValue, out bool replacedExistingValue, out bool mutated) 632Node result = this; 636ImmutableSortedDictionary<TKey, TValue>.Node newRight = _right!.SetOrAdd(key, value, keyComparer, valueComparer, overwriteExistingValue, out replacedExistingValue, out mutated); 644ImmutableSortedDictionary<TKey, TValue>.Node newLeft = _left!.SetOrAdd(key, value, keyComparer, valueComparer, overwriteExistingValue, out replacedExistingValue, out mutated); 680private Node RemoveRecursive(TKey key, IComparer<TKey> keyComparer, out bool mutated) 691Node result = this; 717ImmutableSortedDictionary<TKey, TValue>.Node successor = _right; 723ImmutableSortedDictionary<TKey, TValue>.Node newRight = _right.Remove(successor._key, keyComparer, out _); 729ImmutableSortedDictionary<TKey, TValue>.Node newLeft = _left.Remove(key, keyComparer, out mutated); 737ImmutableSortedDictionary<TKey, TValue>.Node newRight = _right.Remove(key, keyComparer, out mutated); 755private Node Mutate(Node? left = null, Node? right = null) 784private Node Search(TKey key, IComparer<TKey> keyComparer)
System\Collections\Immutable\SortedInt32KeyNode.cs (1)
15/// This is a trimmed down version of <see cref="ImmutableSortedDictionary{TKey, TValue}.Node"/>