Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IndexedWhereQueryOperator.cs
Go to the documentation of this file.
4
6
7internal sealed class IndexedWhereQueryOperator<TInputOutput> : UnaryQueryOperator<TInputOutput, TInputOutput>
8{
9 private sealed class IndexedWhereQueryOperatorEnumerator : QueryOperatorEnumerator<TInputOutput, int>
10 {
12
14
16
18
25
26 internal override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TInputOutput currentElement, ref int currentKey)
27 {
28 if (_outputLoopCount == null)
29 {
31 }
32 while (_source.MoveNext(ref currentElement, ref currentKey))
33 {
34 if ((_outputLoopCount.Value++ & 0x3F) == 0)
35 {
37 }
38 if (_predicate(currentElement, currentKey))
39 {
40 return true;
41 }
42 }
43 return false;
44 }
45
46 protected override void Dispose(bool disposing)
47 {
49 }
50 }
51
53
54 private bool _prematureMerge;
55
56 private bool _limitsParallelism;
57
58 internal override bool LimitsParallelism => _limitsParallelism;
59
67
68 private void InitOrdinalIndexState()
69 {
70 OrdinalIndexState ordinalIndexState = base.Child.OrdinalIndexState;
71 if (ordinalIndexState.IsWorseThan(OrdinalIndexState.Correct))
72 {
73 _prematureMerge = true;
75 }
77 }
78
84
105
107 {
108 IEnumerable<TInputOutput> source = CancellableEnumerable.Wrap(base.Child.AsSequentialQuery(token), token);
109 return source.Where(_predicate);
110 }
111}
override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TInputOutput currentElement, ref int currentKey)
IndexedWhereQueryOperatorEnumerator(QueryOperatorEnumerator< TInputOutput, int > source, Func< TInputOutput, int, bool > predicate, CancellationToken cancellationToken)
override IEnumerable< TInputOutput > AsSequentialQuery(CancellationToken token)
override QueryResults< TInputOutput > Open(QuerySettings settings, bool preferStriping)
readonly Func< TInputOutput, int, bool > _predicate
override void WrapPartitionedStream< TKey >(PartitionedStream< TInputOutput, TKey > inputStream, IPartitionedStreamRecipient< TInputOutput > recipient, bool preferStriping, QuerySettings settings)
IndexedWhereQueryOperator(IEnumerable< TInputOutput > child, Func< TInputOutput, int, bool > predicate)
bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TElement currentElement, [AllowNull] ref TKey currentKey)