Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
OrderedGroupByQueryOperatorEnumerator.cs
Go to the documentation of this file.
4
6
7internal abstract class OrderedGroupByQueryOperatorEnumerator<TSource, TGroupKey, TElement, TOrderKey> : QueryOperatorEnumerator<IGrouping<TGroupKey, TElement>, TOrderKey>
8{
9 private sealed class Mutables
10 {
12
13 internal int _hashLookupIndex;
14 }
15
28
30
32
34
36
38
40
49
50 internal override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref IGrouping<TGroupKey, TElement> currentElement, [AllowNull] ref TOrderKey currentKey)
51 {
53 if (mutables == null)
54 {
55 mutables = (_mutables = new Mutables());
56 mutables._hashLookup = BuildHashLookup();
57 mutables._hashLookupIndex = -1;
58 }
59 if (++mutables._hashLookupIndex < mutables._hashLookup.Count)
60 {
61 GroupKeyData value = mutables._hashLookup[mutables._hashLookupIndex].Value;
62 currentElement = value._grouping;
63 currentKey = value._orderKey;
64 return true;
65 }
66 return false;
67 }
68
70
71 protected override void Dispose(bool disposing)
72 {
73 _source.Dispose();
74 }
75}
GroupKeyData(TOrderKey orderKey, TGroupKey hashKey, IComparer< TOrderKey > orderComparer)
OrderedGroupByQueryOperatorEnumerator(QueryOperatorEnumerator< Pair< TSource, TGroupKey >, TOrderKey > source, Func< TSource, TGroupKey > keySelector, IEqualityComparer< TGroupKey > keyComparer, IComparer< TOrderKey > orderComparer, CancellationToken cancellationToken)
HashLookup< Wrapper< TGroupKey >, GroupKeyData > BuildHashLookup()
readonly QueryOperatorEnumerator< Pair< TSource, TGroupKey >, TOrderKey > _source
override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref IGrouping< TGroupKey, TElement > currentElement, [AllowNull] ref TOrderKey currentKey)