2using System.Collections;
3using System.Threading.Tasks;
12 internal class PagesCursor<T> : ICursor<T>
16 private readonly ICursor<T> cursor;
24 internal PagesCursor(
int Offset,
int MaxCount, ICursor<T> Cursor)
27 this.maxCount = MaxCount;
36 public T Current => this.cursor.Current;
47 public bool CurrentTypeCompatible => this.cursor.CurrentTypeCompatible;
54 public Guid CurrentObjectId => this.cursor.CurrentObjectId;
77 object IEnumerator.Current => this.Current;
86 public bool MoveNext() => this.MoveNextAsyncLocked().Result;
91 public void Reset() => this.cursor.Reset();
99 public async Task<bool> MoveNextAsyncLocked()
103 if (this.maxCount <= 0)
106 if (!await this.cursor.MoveNextAsyncLocked())
109 if (!this.cursor.CurrentTypeCompatible)
129 public Task<bool> MovePreviousAsyncLocked()
131 return this.MoveNextAsyncLocked();
141 public bool SameSortOrder(
string[] ConstantFields,
string[] SortOrder)
143 return this.cursor.SameSortOrder(ConstantFields, SortOrder);
153 public bool ReverseSortOrder(
string[] ConstantFields,
string[] SortOrder)
155 return this.cursor.ReverseSortOrder(ConstantFields, SortOrder);
162 public Task ContinueAfterLocked(T LastItem)
164 return this.cursor.ContinueAfterLocked(LastItem);
171 public Task ContinueBeforeLocked(T LastItem)
173 return this.cursor.ContinueBeforeLocked(LastItem);
Interface for asynchronous enumerators.
Task< bool > MoveNextAsync()
Advances the enumerator to the next element of the collection.
Interface for object serializers.