4 instantiations of HashBucket
System.Collections.Immutable (4)
System\Collections\Immutable\ImmutableHashSet_1.HashBucket.cs (4)
136return new HashBucket(value); 146return new HashBucket(_firstValue, _additionalElements.Add(value)); 223return new HashBucket(_additionalElements.Key, _additionalElements.RemoveAt(indexOfRootNode)); 236return new HashBucket(_firstValue, _additionalElements.RemoveAt(index));
101 references to HashBucket
System.Collections.Immutable (101)
System\Collections\Immutable\ImmutableHashSet_1.Builder.cs (7)
35private SortedInt32KeyNode<HashBucket> _root = SortedInt32KeyNode<HashBucket>.EmptyNode; 45private readonly IEqualityComparer<HashBucket> _hashBucketEqualityComparer; 118ImmutableHashSet<T>.MutationResult result = Union(this, new MutationInput(SortedInt32KeyNode<HashBucket>.EmptyNode, value, _hashBucketEqualityComparer, 0)); 147private SortedInt32KeyNode<HashBucket> Root 209if (_root.TryGetValue(hashCode, out HashBucket bucket)) 268this.Root = SortedInt32KeyNode<HashBucket>.EmptyNode;
System\Collections\Immutable\ImmutableHashSet_1.cs (36)
27public static readonly ImmutableHashSet<T> Empty = new ImmutableHashSet<T>(SortedInt32KeyNode<HashBucket>.EmptyNode, EqualityComparer<T>.Default, 0); 32private static readonly Action<KeyValuePair<int, HashBucket>> s_FreezeBucketAction = (kv) => kv.Value.Freeze(); 47private readonly SortedInt32KeyNode<HashBucket> _root; 52private readonly IEqualityComparer<HashBucket> _hashBucketEqualityComparer; 59: this(SortedInt32KeyNode<HashBucket>.EmptyNode, equalityComparer, 0) 69private ImmutableHashSet(SortedInt32KeyNode<HashBucket> root, IEqualityComparer<T> equalityComparer, int count) 223HashBucket bucket; 630HashBucket bucket = origin.Root.GetValueOrDefault(hashCode); 631ImmutableHashSet<T>.HashBucket newBucket = bucket.Add(item, origin.EqualityComparer, out result); 637SortedInt32KeyNode<ImmutableHashSet<T>.HashBucket> newRoot = UpdateRoot(origin.Root, hashCode, origin.HashBucketEqualityComparer, newBucket); 649HashBucket bucket; 650SortedInt32KeyNode<ImmutableHashSet<T>.HashBucket> newRoot = origin.Root; 653ImmutableHashSet<T>.HashBucket newBucket = bucket.Remove(item, origin.EqualityComparer, out result); 671HashBucket bucket; 688SortedInt32KeyNode<ImmutableHashSet<T>.HashBucket> newRoot = origin.Root; 692HashBucket bucket = newRoot.GetValueOrDefault(hashCode); 694ImmutableHashSet<T>.HashBucket newBucket = bucket.Add(item, origin.EqualityComparer, out result); 711SortedInt32KeyNode<ImmutableHashSet<T>.HashBucket> newRoot = origin.Root; 715HashBucket bucket = newRoot.GetValueOrDefault(hashCode); 717ImmutableHashSet<T>.HashBucket newBucket = bucket.Add(item, origin.EqualityComparer, out result); 777private static SortedInt32KeyNode<HashBucket> UpdateRoot(SortedInt32KeyNode<HashBucket> root, int hashCode, IEqualityComparer<HashBucket> hashBucketEqualityComparer, HashBucket newBucket) 796SortedInt32KeyNode<ImmutableHashSet<T>.HashBucket> newSet = SortedInt32KeyNode<HashBucket>.EmptyNode; 814private static MutationResult Except(IEnumerable<T> other, IEqualityComparer<T> equalityComparer, IEqualityComparer<HashBucket> hashBucketEqualityComparer, SortedInt32KeyNode<HashBucket> root) 821SortedInt32KeyNode<ImmutableHashSet<T>.HashBucket> newRoot = root; 825HashBucket bucket; 829HashBucket newBucket = bucket.Remove(item, equalityComparer, out result); 851SortedInt32KeyNode<ImmutableHashSet<T>.HashBucket> result = SortedInt32KeyNode<HashBucket>.EmptyNode; 990private static ImmutableHashSet<T> Wrap(SortedInt32KeyNode<HashBucket> root, IEqualityComparer<T> equalityComparer, int count) 1003private static IEqualityComparer<HashBucket> GetHashBucketEqualityComparer(IEqualityComparer<T> valueComparer) 1025private ImmutableHashSet<T> Wrap(SortedInt32KeyNode<HashBucket> root, int adjustedCountIfDifferentRoot)
System\Collections\Immutable\ImmutableHashSet_1.Enumerator.cs (7)
26private SortedInt32KeyNode<HashBucket>.Enumerator _mapEnumerator; 31private HashBucket.Enumerator _bucketEnumerator; 43internal Enumerator(SortedInt32KeyNode<HashBucket> root, Builder? builder = null) 46_mapEnumerator = new SortedInt32KeyNode<HashBucket>.Enumerator(root); 47_bucketEnumerator = default(HashBucket.Enumerator); 89_bucketEnumerator = new HashBucket.Enumerator(_mapEnumerator.Current.Value); 107_bucketEnumerator = default(HashBucket.Enumerator);
System\Collections\Immutable\ImmutableHashSet_1.HashBucket.cs (23)
10/// Contains the inner <see cref="ImmutableHashSet{T}.HashBucket"/> struct. 52/// Initializes a new instance of the <see cref="HashBucket"/> struct. 82/// Throws an exception to catch any errors in comparing <see cref="HashBucket"/> instances. 91/// Throws an exception to catch any errors in comparing <see cref="HashBucket"/> instances. 100/// Checks whether this <see cref="HashBucket"/> is exactly like another one, 104/// <returns><c>true</c> if the two <see cref="HashBucket"/> structs have precisely the same values.</returns> 105internal bool EqualsByRef(HashBucket other) 112/// Checks whether this <see cref="HashBucket"/> is exactly like another one, 117/// <returns><c>true</c> if the two <see cref="HashBucket"/> structs have precisely the same values.</returns> 118internal bool EqualsByValue(HashBucket other, IEqualityComparer<T> valueComparer) 129/// <param name="result">A description of the effect was on adding an element to this <see cref="HashBucket"/>.</param> 130/// <returns>A new <see cref="HashBucket"/> that contains the added value and any values already held by this <see cref="HashBucket"/>.</returns> 131internal HashBucket Add(T value, IEqualityComparer<T> valueComparer, out OperationResult result) 150/// Determines whether the <see cref="HashBucket"/> contains the specified value. 200/// <param name="result">A description of the effect was on adding an element to this <see cref="HashBucket"/>.</param> 201/// <returns>A new <see cref="HashBucket"/> that does not contain the removed value and any values already held by this <see cref="HashBucket"/>.</returns> 202internal HashBucket Remove(T value, IEqualityComparer<T> equalityComparer, out OperationResult result) 256private readonly HashBucket _bucket; 269/// The enumerator that represents the current position over the <see cref="_additionalElements"/> of the <see cref="HashBucket"/>. 274/// Initializes a new instance of the <see cref="ImmutableHashSet{T}.HashBucket.Enumerator"/> struct. 277internal Enumerator(HashBucket bucket)
System\Collections\Immutable\ImmutableHashSet_1.HashBucketByRefEqualityComparer.cs (7)
14/// Compares equality between two <see cref="HashBucket"/> instances 17private sealed class HashBucketByRefEqualityComparer : IEqualityComparer<HashBucket> 22private static readonly IEqualityComparer<HashBucket> s_defaultInstance = new HashBucketByRefEqualityComparer(); 27internal static IEqualityComparer<HashBucket> DefaultInstance => s_defaultInstance; 37public bool Equals(HashBucket x, HashBucket y) => x.EqualsByRef(y); 40public int GetHashCode(HashBucket obj) => throw new NotSupportedException();
System\Collections\Immutable\ImmutableHashSet_1.HashBucketByValueEqualityComparer.cs (7)
14/// Compares equality between two <see cref="HashBucket"/> instances 17private sealed class HashBucketByValueEqualityComparer : IEqualityComparer<HashBucket> 22private static readonly IEqualityComparer<HashBucket> s_defaultInstance = new HashBucketByValueEqualityComparer(EqualityComparer<T>.Default); 28internal static IEqualityComparer<HashBucket> DefaultInstance => s_defaultInstance; 46public bool Equals(HashBucket x, HashBucket y) => x.EqualsByValue(y, _valueComparer); 49public int GetHashCode(HashBucket obj) => throw new NotSupportedException();
System\Collections\Immutable\ImmutableHashSet_1.MutationInput.cs (9)
22private readonly SortedInt32KeyNode<HashBucket> _root; 35/// The equality comparer to use when checking for <see cref="HashBucket"/> equality. 37private readonly IEqualityComparer<HashBucket> _hashBucketEqualityComparer; 57/// <param name="hashBucketEqualityComparer">The equality comparer to use when checking for <see cref="HashBucket"/> equality.</param> 59internal MutationInput(SortedInt32KeyNode<HashBucket> root, IEqualityComparer<T> equalityComparer, IEqualityComparer<HashBucket> hashBucketEqualityComparer, int count) 75internal SortedInt32KeyNode<HashBucket> Root 97/// Gets the equality comparer to use when checking for <see cref="HashBucket"/> equality. 99internal IEqualityComparer<HashBucket> HashBucketEqualityComparer => _hashBucketEqualityComparer;
System\Collections\Immutable\ImmutableHashSet_1.MutationResult.cs (3)
35private readonly SortedInt32KeyNode<HashBucket> _root; 55internal MutationResult(SortedInt32KeyNode<HashBucket> root, int count, CountType countType = ImmutableHashSet<T>.CountType.Adjustment) 66internal SortedInt32KeyNode<HashBucket> Root
System\Collections\Immutable\ImmutableHashSet_1.NodeEnumerable.cs (2)
22private readonly SortedInt32KeyNode<HashBucket> _root; 28internal NodeEnumerable(SortedInt32KeyNode<HashBucket> root)