Skip to content

Commit 1126d19

Browse files
committed
Define API for ImmutableSegmentedHashSet<T>
1 parent 0bbcabb commit 1126d19

5 files changed

Lines changed: 390 additions & 0 deletions
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Collections.Generic;
6+
using System.Collections.Immutable;
7+
8+
namespace Microsoft.CodeAnalysis.Collections
9+
{
10+
internal static class ImmutableSegmentedHashSet
11+
{
12+
/// <inheritdoc cref="ImmutableHashSet.Create{T}()"/>
13+
public static ImmutableSegmentedHashSet<T> Create<T>()
14+
=> throw null!;
15+
16+
/// <inheritdoc cref="ImmutableHashSet.Create{T}(T)"/>
17+
public static ImmutableSegmentedHashSet<T> Create<T>(T item)
18+
=> throw null!;
19+
20+
/// <inheritdoc cref="ImmutableHashSet.Create{T}(T[])"/>
21+
public static ImmutableSegmentedHashSet<T> Create<T>(params T[] items)
22+
=> throw null!;
23+
24+
/// <inheritdoc cref="ImmutableHashSet.Create{T}(IEqualityComparer{T})"/>
25+
public static ImmutableSegmentedHashSet<T> Create<T>(IEqualityComparer<T>? equalityComparer)
26+
=> throw null!;
27+
28+
/// <inheritdoc cref="ImmutableHashSet.Create{T}(IEqualityComparer{T}?, T)"/>
29+
public static ImmutableSegmentedHashSet<T> Create<T>(IEqualityComparer<T>? equalityComparer, T item)
30+
=> throw null!;
31+
32+
/// <inheritdoc cref="ImmutableHashSet.Create{T}(IEqualityComparer{T}?, T[])"/>
33+
public static ImmutableSegmentedHashSet<T> Create<T>(IEqualityComparer<T>? equalityComparer, params T[] items)
34+
=> throw null!;
35+
36+
/// <inheritdoc cref="ImmutableHashSet.CreateBuilder{T}()"/>
37+
public static ImmutableSegmentedHashSet<T>.Builder CreateBuilder<T>()
38+
=> throw null!;
39+
40+
/// <inheritdoc cref="ImmutableHashSet.CreateBuilder{T}(IEqualityComparer{T}?)"/>
41+
public static ImmutableSegmentedHashSet<T>.Builder CreateBuilder<T>(IEqualityComparer<T>? equalityComparer)
42+
=> throw null!;
43+
44+
/// <inheritdoc cref="ImmutableHashSet.CreateRange{T}(IEnumerable{T})"/>
45+
public static ImmutableSegmentedHashSet<T> CreateRange<T>(IEnumerable<T> items)
46+
=> throw null!;
47+
48+
/// <inheritdoc cref="ImmutableHashSet.CreateRange{T}(IEqualityComparer{T}?, IEnumerable{T})"/>
49+
public static ImmutableSegmentedHashSet<T> CreateRange<T>(IEqualityComparer<T>? equalityComparer, IEnumerable<T> items)
50+
=> throw null!;
51+
52+
/// <inheritdoc cref="ImmutableHashSet.ToImmutableHashSet{TSource}(IEnumerable{TSource})"/>
53+
public static ImmutableSegmentedHashSet<TSource> ToImmutableSegmentedHashSet<TSource>(this IEnumerable<TSource> source)
54+
=> throw null!;
55+
56+
/// <inheritdoc cref="ImmutableHashSet.ToImmutableHashSet{TSource}(IEnumerable{TSource}, IEqualityComparer{TSource}?)"/>
57+
public static ImmutableSegmentedHashSet<TSource> ToImmutableSegmentedHashSet<TSource>(this IEnumerable<TSource> source, IEqualityComparer<TSource>? equalityComparer)
58+
=> throw null!;
59+
60+
/// <inheritdoc cref="ImmutableHashSet.ToImmutableHashSet{TSource}(ImmutableHashSet{TSource}.Builder)"/>
61+
public static ImmutableSegmentedHashSet<TSource> ToImmutableSegmentedHashSet<TSource>(this ImmutableSegmentedHashSet<TSource>.Builder builder)
62+
=> throw null!;
63+
}
64+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Collections;
6+
using System.Collections.Generic;
7+
using System.Collections.Immutable;
8+
9+
namespace Microsoft.CodeAnalysis.Collections
10+
{
11+
internal readonly partial struct ImmutableSegmentedHashSet<T>
12+
{
13+
public sealed class Builder : ISet<T>, IReadOnlyCollection<T>
14+
{
15+
internal Builder(ImmutableSegmentedHashSet<T> set)
16+
=> throw null!;
17+
18+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.KeyComparer"/>
19+
public IEqualityComparer<T> KeyComparer => throw null!;
20+
21+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.Count"/>
22+
public int Count => throw null!;
23+
24+
bool ICollection<T>.IsReadOnly => throw null!;
25+
26+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.Add(T)"/>
27+
public bool Add(T item)
28+
=> throw null!;
29+
30+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.Clear()"/>
31+
public void Clear()
32+
=> throw null!;
33+
34+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.Contains(T)"/>
35+
public bool Contains(T item)
36+
=> throw null!;
37+
38+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.ExceptWith(IEnumerable{T})"/>
39+
public void ExceptWith(IEnumerable<T> other)
40+
=> throw null!;
41+
42+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.GetEnumerator()"/>
43+
public Enumerator GetEnumerator()
44+
=> throw null!;
45+
46+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.IntersectWith(IEnumerable{T})"/>
47+
public void IntersectWith(IEnumerable<T> other)
48+
=> throw null!;
49+
50+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.IsProperSubsetOf(IEnumerable{T})"/>
51+
public bool IsProperSubsetOf(IEnumerable<T> other)
52+
=> throw null!;
53+
54+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.IsProperSupersetOf(IEnumerable{T})"/>
55+
public bool IsProperSupersetOf(IEnumerable<T> other)
56+
=> throw null!;
57+
58+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.IsSubsetOf(IEnumerable{T})"/>
59+
public bool IsSubsetOf(IEnumerable<T> other)
60+
=> throw null!;
61+
62+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.IsSupersetOf(IEnumerable{T})"/>
63+
public bool IsSupersetOf(IEnumerable<T> other)
64+
=> throw null!;
65+
66+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.Overlaps(IEnumerable{T})"/>
67+
public bool Overlaps(IEnumerable<T> other)
68+
=> throw null!;
69+
70+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.Remove(T)"/>
71+
public bool Remove(T item)
72+
=> throw null!;
73+
74+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.SetEquals(IEnumerable{T})"/>
75+
public bool SetEquals(IEnumerable<T> other)
76+
=> throw null!;
77+
78+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.SymmetricExceptWith(IEnumerable{T})"/>
79+
public void SymmetricExceptWith(IEnumerable<T> other)
80+
=> throw null!;
81+
82+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.UnionWith(IEnumerable{T})"/>
83+
public void UnionWith(IEnumerable<T> other)
84+
=> throw null!;
85+
86+
/// <inheritdoc cref="ImmutableHashSet{T}.Builder.ToImmutable()"/>
87+
public ImmutableSegmentedHashSet<T> ToImmutable()
88+
=> throw null!;
89+
90+
void ICollection<T>.Add(T item)
91+
=> throw null!;
92+
93+
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
94+
=> throw null!;
95+
96+
IEnumerator<T> IEnumerable<T>.GetEnumerator()
97+
=> throw null!;
98+
99+
IEnumerator IEnumerable.GetEnumerator()
100+
=> throw null!;
101+
}
102+
}
103+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Collections;
6+
using System.Collections.Generic;
7+
using System.Collections.Immutable;
8+
9+
namespace Microsoft.CodeAnalysis.Collections
10+
{
11+
internal readonly partial struct ImmutableSegmentedHashSet<T>
12+
{
13+
/// <inheritdoc cref="ImmutableHashSet{T}.Enumerator"/>
14+
public struct Enumerator : IEnumerator<T>
15+
{
16+
internal Enumerator(SegmentedHashSet<T> set)
17+
=> throw null!;
18+
19+
/// <inheritdoc cref="ImmutableHashSet{T}.Enumerator.Current"/>
20+
public T Current => throw null!;
21+
22+
object? IEnumerator.Current => throw null!;
23+
24+
/// <inheritdoc cref="ImmutableHashSet{T}.Enumerator.Dispose()"/>
25+
public void Dispose()
26+
=> throw null!;
27+
28+
/// <inheritdoc cref="ImmutableHashSet{T}.Enumerator.MoveNext()"/>
29+
public bool MoveNext()
30+
=> throw null!;
31+
32+
/// <inheritdoc cref="ImmutableHashSet{T}.Enumerator.Reset()"/>
33+
public void Reset()
34+
=> throw null!;
35+
}
36+
}
37+
}
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
using System.Collections;
7+
using System.Collections.Generic;
8+
using System.Collections.Immutable;
9+
10+
namespace Microsoft.CodeAnalysis.Collections
11+
{
12+
internal readonly partial struct ImmutableSegmentedHashSet<T> : IImmutableSet<T>, ISet<T>, ICollection, IEquatable<ImmutableSegmentedHashSet<T>>
13+
{
14+
/// <inheritdoc cref="ImmutableHashSet{T}.Empty"/>
15+
public static readonly ImmutableSegmentedHashSet<T> Empty;
16+
17+
/// <inheritdoc cref="ImmutableHashSet{T}.KeyComparer"/>
18+
public IEqualityComparer<T> KeyComparer => throw null!;
19+
20+
/// <inheritdoc cref="ImmutableHashSet{T}.Count"/>
21+
public int Count => throw null!;
22+
23+
/// <inheritdoc cref="ImmutableHashSet{T}.IsEmpty"/>
24+
public bool IsEmpty => throw null!;
25+
26+
bool ICollection<T>.IsReadOnly => throw null!;
27+
28+
bool ICollection.IsSynchronized => throw null!;
29+
30+
object ICollection.SyncRoot => throw null!;
31+
32+
public static bool operator ==(ImmutableSegmentedHashSet<T> left, ImmutableSegmentedHashSet<T> right)
33+
=> throw null!;
34+
35+
public static bool operator !=(ImmutableSegmentedHashSet<T> left, ImmutableSegmentedHashSet<T> right)
36+
=> throw null!;
37+
38+
public static bool operator ==(ImmutableSegmentedHashSet<T>? left, ImmutableSegmentedHashSet<T>? right)
39+
=> throw null!;
40+
41+
public static bool operator !=(ImmutableSegmentedHashSet<T>? left, ImmutableSegmentedHashSet<T>? right)
42+
=> throw null!;
43+
44+
/// <inheritdoc cref="ImmutableHashSet{T}.Add(T)"/>
45+
public ImmutableSegmentedHashSet<T> Add(T value)
46+
=> throw null!;
47+
48+
/// <inheritdoc cref="ImmutableHashSet{T}.Clear()"/>
49+
public ImmutableSegmentedHashSet<T> Clear()
50+
=> throw null!;
51+
52+
/// <inheritdoc cref="ImmutableHashSet{T}.Contains(T)"/>
53+
public bool Contains(T value)
54+
=> throw null!;
55+
56+
/// <inheritdoc cref="ImmutableHashSet{T}.Except(IEnumerable{T})"/>
57+
public ImmutableSegmentedHashSet<T> Except(IEnumerable<T> other)
58+
=> throw null!;
59+
60+
/// <inheritdoc cref="ImmutableHashSet{T}.GetEnumerator()"/>
61+
public Enumerator GetEnumerator()
62+
=> throw null!;
63+
64+
/// <inheritdoc cref="ImmutableHashSet{T}.Intersect(IEnumerable{T})"/>
65+
public ImmutableSegmentedHashSet<T> Intersect(IEnumerable<T> other)
66+
=> throw null!;
67+
68+
/// <inheritdoc cref="ImmutableHashSet{T}.IsProperSubsetOf(IEnumerable{T})"/>
69+
public bool IsProperSubsetOf(IEnumerable<T> other)
70+
=> throw null!;
71+
72+
/// <inheritdoc cref="ImmutableHashSet{T}.IsProperSupersetOf(IEnumerable{T})"/>
73+
public bool IsProperSupersetOf(IEnumerable<T> other)
74+
=> throw null!;
75+
76+
/// <inheritdoc cref="ImmutableHashSet{T}.IsSubsetOf(IEnumerable{T})"/>
77+
public bool IsSubsetOf(IEnumerable<T> other)
78+
=> throw null!;
79+
80+
/// <inheritdoc cref="ImmutableHashSet{T}.IsSupersetOf(IEnumerable{T})"/>
81+
public bool IsSupersetOf(IEnumerable<T> other)
82+
=> throw null!;
83+
84+
/// <inheritdoc cref="ImmutableHashSet{T}.Overlaps(IEnumerable{T})"/>
85+
public bool Overlaps(IEnumerable<T> other)
86+
=> throw null!;
87+
88+
/// <inheritdoc cref="ImmutableHashSet{T}.Remove(T)"/>
89+
public ImmutableSegmentedHashSet<T> Remove(T value)
90+
=> throw null!;
91+
92+
/// <inheritdoc cref="ImmutableHashSet{T}.SetEquals(IEnumerable{T})"/>
93+
public bool SetEquals(IEnumerable<T> other)
94+
=> throw null!;
95+
96+
/// <inheritdoc cref="ImmutableHashSet{T}.SymmetricExcept(IEnumerable{T})"/>
97+
public ImmutableSegmentedHashSet<T> SymmetricExcept(IEnumerable<T> other)
98+
=> throw null!;
99+
100+
/// <inheritdoc cref="ImmutableHashSet{T}.TryGetValue(T, out T)"/>
101+
public bool TryGetValue(T equalValue, out T actualValue)
102+
=> throw null!;
103+
104+
/// <inheritdoc cref="ImmutableHashSet{T}.Union(IEnumerable{T})"/>
105+
public ImmutableSegmentedHashSet<T> Union(IEnumerable<T> other)
106+
=> throw null!;
107+
108+
/// <inheritdoc cref="ImmutableHashSet{T}.ToBuilder()"/>
109+
public Builder ToBuilder()
110+
=> throw null!;
111+
112+
/// <inheritdoc cref="ImmutableHashSet{T}.WithComparer(IEqualityComparer{T}?)"/>
113+
public ImmutableSegmentedHashSet<T> WithComparer(IEqualityComparer<T>? equalityComparer)
114+
=> throw null!;
115+
116+
public override int GetHashCode()
117+
=> throw null!;
118+
119+
public override bool Equals(object? obj)
120+
=> throw null!;
121+
122+
public bool Equals(ImmutableSegmentedHashSet<T> other)
123+
=> throw null!;
124+
125+
IImmutableSet<T> IImmutableSet<T>.Clear()
126+
=> throw null!;
127+
128+
IImmutableSet<T> IImmutableSet<T>.Add(T value)
129+
=> throw null!;
130+
131+
IImmutableSet<T> IImmutableSet<T>.Remove(T value)
132+
=> throw null!;
133+
134+
IImmutableSet<T> IImmutableSet<T>.Intersect(IEnumerable<T> other)
135+
=> throw null!;
136+
137+
IImmutableSet<T> IImmutableSet<T>.Except(IEnumerable<T> other)
138+
=> throw null!;
139+
140+
IImmutableSet<T> IImmutableSet<T>.SymmetricExcept(IEnumerable<T> other)
141+
=> throw null!;
142+
143+
IImmutableSet<T> IImmutableSet<T>.Union(IEnumerable<T> other)
144+
=> throw null!;
145+
146+
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
147+
=> throw null!;
148+
149+
void ICollection.CopyTo(Array array, int index)
150+
=> throw null!;
151+
152+
IEnumerator<T> IEnumerable<T>.GetEnumerator()
153+
=> throw null!;
154+
155+
IEnumerator IEnumerable.GetEnumerator()
156+
=> throw null!;
157+
158+
bool ISet<T>.Add(T item)
159+
=> throw new NotSupportedException();
160+
161+
void ISet<T>.UnionWith(IEnumerable<T> other)
162+
=> throw new NotSupportedException();
163+
164+
void ISet<T>.IntersectWith(IEnumerable<T> other)
165+
=> throw new NotSupportedException();
166+
167+
void ISet<T>.ExceptWith(IEnumerable<T> other)
168+
=> throw new NotSupportedException();
169+
170+
void ISet<T>.SymmetricExceptWith(IEnumerable<T> other)
171+
=> throw new NotSupportedException();
172+
173+
void ICollection<T>.Add(T item)
174+
=> throw new NotSupportedException();
175+
176+
void ICollection<T>.Clear()
177+
=> throw new NotSupportedException();
178+
179+
bool ICollection<T>.Remove(T item)
180+
=> throw new NotSupportedException();
181+
}
182+
}

0 commit comments

Comments
 (0)