Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ MoveNext() [2/2]

override bool System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >.MoveNext ( ref Pair< TInputOutput, THashKey > currentElement,
ref int currentKey )
inlinepackage

Definition at line 51 of file HashRepartitionEnumerator.cs.

52 {
53 if (_partitionCount == 1)
54 {
55 TIgnoreKey currentKey2 = default(TIgnoreKey);
56 TInputOutput currentElement2 = default(TInputOutput);
57 if (_source.MoveNext(ref currentElement2, ref currentKey2))
58 {
59 currentElement = new Pair<TInputOutput, THashKey>(currentElement2, (_keySelector == null) ? default(THashKey) : _keySelector(currentElement2));
60 return true;
61 }
62 return false;
63 }
64 Mutables mutables = _mutables;
65 if (mutables == null)
66 {
67 mutables = (_mutables = new Mutables());
68 }
69 if (mutables._currentBufferIndex == -1)
70 {
72 }
73 while (mutables._currentBufferIndex < _partitionCount)
74 {
75 if (mutables._currentBuffer != null)
76 {
77 if (++mutables._currentIndex < mutables._currentBuffer.Count)
78 {
79 currentElement = mutables._currentBuffer._chunk[mutables._currentIndex];
80 return true;
81 }
82 mutables._currentIndex = -1;
83 mutables._currentBuffer = mutables._currentBuffer.Next;
84 continue;
85 }
86 if (mutables._currentBufferIndex == _partitionIndex)
87 {
89 mutables._currentBufferIndex = -1;
90 }
91 mutables._currentBufferIndex++;
92 mutables._currentIndex = -1;
93 if (mutables._currentBufferIndex == _partitionIndex)
94 {
95 mutables._currentBufferIndex++;
96 }
97 if (mutables._currentBufferIndex < _partitionCount)
98 {
99 mutables._currentBuffer = _valueExchangeMatrix[mutables._currentBufferIndex][_partitionIndex];
100 }
101 }
102 return false;
103 }
readonly Func< TInputOutput, THashKey > _keySelector
readonly QueryOperatorEnumerator< TInputOutput, TIgnoreKey > _source
readonly ListChunk< Pair< TInputOutput, THashKey > >[][] _valueExchangeMatrix
bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TElement currentElement, [AllowNull] ref TKey currentKey)

References System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._barrier, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._cancellationToken, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >.Mutables._currentBuffer, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >.Mutables._currentBufferIndex, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >.Mutables._currentIndex, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._keySelector, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._mutables, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._partitionCount, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._partitionIndex, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._source, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._valueExchangeMatrix, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >.EnumerateAndRedistributeElements(), System.Linq.Parallel.QueryOperatorEnumerator< TElement, TKey >.MoveNext(), and System.Threading.CountdownEvent.Wait().