4 instantiations of HashBucket
System.Collections.Immutable (4)
System\Collections\Immutable\ImmutableHashSet_1.HashBucket.cs (4)
136
return new
HashBucket
(value);
146
return new
HashBucket
(_firstValue, _additionalElements.Add(value));
223
return new
HashBucket
(_additionalElements.Key, _additionalElements.RemoveAt(indexOfRootNode));
236
return new
HashBucket
(_firstValue, _additionalElements.RemoveAt(index));
101 references to HashBucket
System.Collections.Immutable (101)
System\Collections\Immutable\ImmutableHashSet_1.Builder.cs (7)
35
private SortedInt32KeyNode<
HashBucket
> _root = SortedInt32KeyNode<
HashBucket
>.EmptyNode;
45
private readonly IEqualityComparer<
HashBucket
> _hashBucketEqualityComparer;
118
ImmutableHashSet<T>.MutationResult result = Union(this, new MutationInput(SortedInt32KeyNode<
HashBucket
>.EmptyNode, value, _hashBucketEqualityComparer, 0));
147
private SortedInt32KeyNode<
HashBucket
> Root
209
if (_root.TryGetValue(hashCode, out
HashBucket
bucket))
268
this.Root = SortedInt32KeyNode<
HashBucket
>.EmptyNode;
System\Collections\Immutable\ImmutableHashSet_1.cs (36)
27
public static readonly ImmutableHashSet<T> Empty = new ImmutableHashSet<T>(SortedInt32KeyNode<
HashBucket
>.EmptyNode, EqualityComparer<T>.Default, 0);
32
private static readonly Action<KeyValuePair<int,
HashBucket
>> s_FreezeBucketAction = (kv) => kv.Value.Freeze();
47
private readonly SortedInt32KeyNode<
HashBucket
> _root;
52
private readonly IEqualityComparer<
HashBucket
> _hashBucketEqualityComparer;
59
: this(SortedInt32KeyNode<
HashBucket
>.EmptyNode, equalityComparer, 0)
69
private ImmutableHashSet(SortedInt32KeyNode<
HashBucket
> root, IEqualityComparer<T> equalityComparer, int count)
211
HashBucket
bucket;
618
HashBucket
bucket = origin.Root.GetValueOrDefault(hashCode);
619
ImmutableHashSet<T>.
HashBucket
newBucket = bucket.Add(item, origin.EqualityComparer, out result);
625
SortedInt32KeyNode<ImmutableHashSet<T>.
HashBucket
> newRoot = UpdateRoot(origin.Root, hashCode, origin.HashBucketEqualityComparer, newBucket);
637
HashBucket
bucket;
638
SortedInt32KeyNode<ImmutableHashSet<T>.
HashBucket
> newRoot = origin.Root;
641
ImmutableHashSet<T>.
HashBucket
newBucket = bucket.Remove(item, origin.EqualityComparer, out result);
659
HashBucket
bucket;
676
SortedInt32KeyNode<ImmutableHashSet<T>.
HashBucket
> newRoot = origin.Root;
680
HashBucket
bucket = newRoot.GetValueOrDefault(hashCode);
682
ImmutableHashSet<T>.
HashBucket
newBucket = bucket.Add(item, origin.EqualityComparer, out result);
699
SortedInt32KeyNode<ImmutableHashSet<T>.
HashBucket
> newRoot = origin.Root;
703
HashBucket
bucket = newRoot.GetValueOrDefault(hashCode);
705
ImmutableHashSet<T>.
HashBucket
newBucket = bucket.Add(item, origin.EqualityComparer, out result);
765
private static SortedInt32KeyNode<
HashBucket
> UpdateRoot(SortedInt32KeyNode<
HashBucket
> root, int hashCode, IEqualityComparer<
HashBucket
> hashBucketEqualityComparer,
HashBucket
newBucket)
784
SortedInt32KeyNode<ImmutableHashSet<T>.
HashBucket
> newSet = SortedInt32KeyNode<
HashBucket
>.EmptyNode;
802
private static MutationResult Except(IEnumerable<T> other, IEqualityComparer<T> equalityComparer, IEqualityComparer<
HashBucket
> hashBucketEqualityComparer, SortedInt32KeyNode<
HashBucket
> root)
809
SortedInt32KeyNode<ImmutableHashSet<T>.
HashBucket
> newRoot = root;
813
HashBucket
bucket;
817
HashBucket
newBucket = bucket.Remove(item, equalityComparer, out result);
839
SortedInt32KeyNode<ImmutableHashSet<T>.
HashBucket
> result = SortedInt32KeyNode<
HashBucket
>.EmptyNode;
978
private static ImmutableHashSet<T> Wrap(SortedInt32KeyNode<
HashBucket
> root, IEqualityComparer<T> equalityComparer, int count)
991
private static IEqualityComparer<
HashBucket
> GetHashBucketEqualityComparer(IEqualityComparer<T> valueComparer)
1013
private ImmutableHashSet<T> Wrap(SortedInt32KeyNode<
HashBucket
> root, int adjustedCountIfDifferentRoot)
System\Collections\Immutable\ImmutableHashSet_1.Enumerator.cs (7)
26
private SortedInt32KeyNode<
HashBucket
>.Enumerator _mapEnumerator;
31
private
HashBucket
.Enumerator _bucketEnumerator;
43
internal 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>
105
internal 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>
118
internal 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>
131
internal
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>
202
internal
HashBucket
Remove(T value, IEqualityComparer<T> equalityComparer, out OperationResult result)
256
private 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.
277
internal Enumerator(
HashBucket
bucket)
System\Collections\Immutable\ImmutableHashSet_1.HashBucketByRefEqualityComparer.cs (7)
14
/// Compares equality between two <see cref="
HashBucket
"/> instances
17
private sealed class HashBucketByRefEqualityComparer : IEqualityComparer<
HashBucket
>
22
private static readonly IEqualityComparer<
HashBucket
> s_defaultInstance = new HashBucketByRefEqualityComparer();
27
internal static IEqualityComparer<
HashBucket
> DefaultInstance => s_defaultInstance;
37
public bool Equals(
HashBucket
x,
HashBucket
y) => x.EqualsByRef(y);
40
public int GetHashCode(
HashBucket
obj) => throw new NotSupportedException();
System\Collections\Immutable\ImmutableHashSet_1.HashBucketByValueEqualityComparer.cs (7)
14
/// Compares equality between two <see cref="
HashBucket
"/> instances
17
private sealed class HashBucketByValueEqualityComparer : IEqualityComparer<
HashBucket
>
22
private static readonly IEqualityComparer<
HashBucket
> s_defaultInstance = new HashBucketByValueEqualityComparer(EqualityComparer<T>.Default);
28
internal static IEqualityComparer<
HashBucket
> DefaultInstance => s_defaultInstance;
46
public bool Equals(
HashBucket
x,
HashBucket
y) => x.EqualsByValue(y, _valueComparer);
49
public int GetHashCode(
HashBucket
obj) => throw new NotSupportedException();
System\Collections\Immutable\ImmutableHashSet_1.MutationInput.cs (9)
22
private readonly SortedInt32KeyNode<
HashBucket
> _root;
35
/// The equality comparer to use when checking for <see cref="
HashBucket
"/> equality.
37
private readonly IEqualityComparer<
HashBucket
> _hashBucketEqualityComparer;
57
/// <param name="hashBucketEqualityComparer">The equality comparer to use when checking for <see cref="
HashBucket
"/> equality.</param>
59
internal MutationInput(SortedInt32KeyNode<
HashBucket
> root, IEqualityComparer<T> equalityComparer, IEqualityComparer<
HashBucket
> hashBucketEqualityComparer, int count)
75
internal SortedInt32KeyNode<
HashBucket
> Root
97
/// Gets the equality comparer to use when checking for <see cref="
HashBucket
"/> equality.
99
internal IEqualityComparer<
HashBucket
> HashBucketEqualityComparer => _hashBucketEqualityComparer;
System\Collections\Immutable\ImmutableHashSet_1.MutationResult.cs (3)
35
private readonly SortedInt32KeyNode<
HashBucket
> _root;
55
internal MutationResult(SortedInt32KeyNode<
HashBucket
> root, int count, CountType countType = ImmutableHashSet<T>.CountType.Adjustment)
66
internal SortedInt32KeyNode<
HashBucket
> Root
System\Collections\Immutable\ImmutableHashSet_1.NodeEnumerable.cs (2)
22
private readonly SortedInt32KeyNode<
HashBucket
> _root;
28
internal NodeEnumerable(SortedInt32KeyNode<
HashBucket
> root)