Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
GroupByQueryOperatorEnumerator.cs
Go to the documentation of this file.
4
6
7internal abstract class GroupByQueryOperatorEnumerator<TSource, TGroupKey, TElement, TOrderKey> : QueryOperatorEnumerator<IGrouping<TGroupKey, TElement>, TOrderKey>
8{
9 private sealed class Mutables
10 {
12
13 internal int _hashLookupIndex;
14 }
15
17
19
21
23
30
31 internal override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref IGrouping<TGroupKey, TElement> currentElement, [AllowNull] ref TOrderKey currentKey)
32 {
34 if (mutables == null)
35 {
36 mutables = (_mutables = new Mutables());
37 mutables._hashLookup = BuildHashLookup();
38 mutables._hashLookupIndex = -1;
39 }
40 if (++mutables._hashLookupIndex < mutables._hashLookup.Count)
41 {
42 currentElement = new GroupByGrouping<TGroupKey, TElement>(mutables._hashLookup[mutables._hashLookupIndex]);
43 return true;
44 }
45 return false;
46 }
47
49
50 protected override void Dispose(bool disposing)
51 {
52 _source.Dispose();
53 }
54}
HashLookup< Wrapper< TGroupKey >, ListChunk< TElement > > _hashLookup
HashLookup< Wrapper< TGroupKey >, ListChunk< TElement > > BuildHashLookup()
override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref IGrouping< TGroupKey, TElement > currentElement, [AllowNull] ref TOrderKey currentKey)
GroupByQueryOperatorEnumerator(QueryOperatorEnumerator< Pair< TSource, TGroupKey >, TOrderKey > source, IEqualityComparer< TGroupKey > keyComparer, CancellationToken cancellationToken)
readonly QueryOperatorEnumerator< Pair< TSource, TGroupKey >, TOrderKey > _source