Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ConcatQueryOperator.cs
Go to the documentation of this file.
4
6
7internal sealed class ConcatQueryOperator<TSource> : BinaryQueryOperator<TSource, TSource, TSource>
8{
9 private sealed class ConcatQueryOperatorEnumerator<TLeftKey, TRightKey> : QueryOperatorEnumerator<TSource, ConcatKey<TLeftKey, TRightKey>>
10 {
12
14
15 private bool _begunSecond;
16
22
23 internal override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TSource currentElement, ref ConcatKey<TLeftKey, TRightKey> currentKey)
24 {
25 if (!_begunSecond)
26 {
27 TLeftKey currentKey2 = default(TLeftKey);
29 {
30 currentKey = ConcatKey<TLeftKey, TRightKey>.MakeLeft(currentKey2);
31 return true;
32 }
33 _begunSecond = true;
34 }
37 {
38 currentKey = ConcatKey<TLeftKey, TRightKey>.MakeRight(currentKey3);
39 return true;
40 }
41 return false;
42 }
43
44 protected override void Dispose(bool disposing)
45 {
48 }
49 }
50
52 {
53 private readonly int _leftChildCount;
54
55 private readonly int _rightChildCount;
56
57 internal override bool IsIndexible => true;
58
60
69
76
77 internal override TSource GetElement(int index)
78 {
80 {
81 return _leftChildQueryResults.GetElement(index);
82 }
83 return _rightChildQueryResults.GetElement(index - _leftChildCount);
84 }
85 }
86
87 private readonly bool _prematureMergeLeft;
88
89 private readonly bool _prematureMergeRight;
90
91 internal override bool LimitsParallelism => false;
92
95 {
96 _outputOrdered = base.LeftChild.OutputOrdered || base.RightChild.OutputOrdered;
97 _prematureMergeLeft = base.LeftChild.OrdinalIndexState.IsWorseThan(OrdinalIndexState.Increasing);
98 _prematureMergeRight = base.RightChild.OrdinalIndexState.IsWorseThan(OrdinalIndexState.Increasing);
99 if (base.LeftChild.OrdinalIndexState == OrdinalIndexState.Indexable && base.RightChild.OrdinalIndexState == OrdinalIndexState.Indexable)
100 {
102 }
103 else
104 {
105 SetOrdinalIndex(OrdinalIndexState.Increasing.Worse(base.LeftChild.OrdinalIndexState.Worse(base.RightChild.OrdinalIndexState)));
106 }
107 }
108
115
129
143
155
157 {
158 return base.LeftChild.AsSequentialQuery(token).Concat(base.RightChild.AsSequentialQuery(token));
159 }
160}
ConcatQueryOperatorEnumerator(QueryOperatorEnumerator< TSource, TLeftKey > firstSource, QueryOperatorEnumerator< TSource, TRightKey > secondSource)
readonly QueryOperatorEnumerator< TSource, TRightKey > _secondSource
override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TSource currentElement, ref ConcatKey< TLeftKey, TRightKey > currentKey)
readonly QueryOperatorEnumerator< TSource, TLeftKey > _firstSource
static QueryResults< TSource > NewResults(QueryResults< TSource > leftChildQueryResults, QueryResults< TSource > rightChildQueryResults, ConcatQueryOperator< TSource > op, QuerySettings settings, bool preferStriping)
ConcatQueryOperatorResults(QueryResults< TSource > leftChildQueryResults, QueryResults< TSource > rightChildQueryResults, ConcatQueryOperator< TSource > concatOp, QuerySettings settings, bool preferStriping)
ConcatQueryOperator(ParallelQuery< TSource > firstChild, ParallelQuery< TSource > secondChild)
void WrapHelper< TLeftKey, TRightKey >(PartitionedStream< TSource, TLeftKey > leftStreamInc, PartitionedStream< TSource, TRightKey > rightStream, IPartitionedStreamRecipient< TSource > outputRecipient, QuerySettings settings, bool preferStriping)
override QueryResults< TSource > Open(QuerySettings settings, bool preferStriping)
void WrapHelper2< TLeftKey, TRightKey >(PartitionedStream< TSource, TLeftKey > leftStreamInc, PartitionedStream< TSource, TRightKey > rightStreamInc, IPartitionedStreamRecipient< TSource > outputRecipient)
override IEnumerable< TSource > AsSequentialQuery(CancellationToken token)
override void WrapPartitionedStream< TLeftKey, TRightKey >(PartitionedStream< TSource, TLeftKey > leftStream, PartitionedStream< TSource, TRightKey > rightStream, IPartitionedStreamRecipient< TSource > outputRecipient, bool preferStriping, QuerySettings settings)
bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TElement currentElement, [AllowNull] ref TKey currentKey)