Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ReverseQueryOperator.cs
Go to the documentation of this file.
4
6
7internal sealed class ReverseQueryOperator<TSource> : UnaryQueryOperator<TSource, TSource>
8{
9 private sealed class ReverseQueryOperatorEnumerator<TKey> : QueryOperatorEnumerator<TSource, TKey>
10 {
12
14
16
18
24
25 internal override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TSource currentElement, [AllowNull] ref TKey currentKey)
26 {
27 if (_buffer == null)
28 {
31 TSource currentElement2 = default(TSource);
32 TKey currentKey2 = default(TKey);
33 int num = 0;
35 {
36 if ((num++ & 0x3F) == 0)
37 {
39 }
42 }
43 }
44 if (--_bufferIndex.Value >= 0)
45 {
47 currentKey = _buffer[_bufferIndex.Value].Second;
48 return true;
49 }
50 return false;
51 }
52
53 protected override void Dispose(bool disposing)
54 {
56 }
57 }
58
60 {
61 private readonly int _count;
62
63 internal override bool IsIndexible => true;
64
65 internal override int ElementsCount => _count;
66
75
77 : base(childQueryResults, (UnaryQueryOperator<TSource, TSource>)op, settings, preferStriping)
78 {
79 _count = _childQueryResults.ElementsCount;
80 }
81
82 internal override TSource GetElement(int index)
83 {
84 return _childQueryResults.GetElement(_count - index - 1);
85 }
86 }
87
88 internal override bool LimitsParallelism => false;
89
91 : base(child)
92 {
93 if (base.Child.OrdinalIndexState == OrdinalIndexState.Indexable)
94 {
96 }
97 else
98 {
100 }
101 }
102
113
114 internal override QueryResults<TSource> Open(QuerySettings settings, bool preferStriping)
115 {
116 QueryResults<TSource> childQueryResults = base.Child.Open(settings, preferStriping: false);
118 }
119
121 {
122 IEnumerable<TSource> source = CancellableEnumerable.Wrap(base.Child.AsSequentialQuery(token), token);
123 return source.Reverse();
124 }
125}
void Add(TKey key, TValue value)
bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TElement currentElement, [AllowNull] ref TKey currentKey)
override bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TSource currentElement, [AllowNull] ref TKey currentKey)
ReverseQueryOperatorEnumerator(QueryOperatorEnumerator< TSource, TKey > source, CancellationToken cancellationToken)
static QueryResults< TSource > NewResults(QueryResults< TSource > childQueryResults, ReverseQueryOperator< TSource > op, QuerySettings settings, bool preferStriping)
ReverseQueryOperatorResults(QueryResults< TSource > childQueryResults, ReverseQueryOperator< TSource > op, QuerySettings settings, bool preferStriping)
override IEnumerable< TSource > AsSequentialQuery(CancellationToken token)
override void WrapPartitionedStream< TKey >(PartitionedStream< TSource, TKey > inputStream, IPartitionedStreamRecipient< TSource > recipient, bool preferStriping, QuerySettings settings)
ReverseQueryOperator(IEnumerable< TSource > child)
override QueryResults< TSource > Open(QuerySettings settings, bool preferStriping)