public AsyncSortSequenceContext( AsyncSortContext <TElement> childContext, Func <TElement, Task <TKey> > keySelector, IComparer <TKey> comparer, bool descending ) : base(childContext, @descending) { this.keySelector = keySelector; this.comparer = comparer; }
internal override AsyncSortContext <TElement> CreateContext(AsyncSortContext <TElement> current) { AsyncSortContext <TElement> context = new AsyncSortSequenceContext <TElement, TKey> (current, keySelector, comparer, descending); return(parent != null?parent.CreateContext(context) : context); }
internal abstract AsyncSortContext <TValue> CreateContext(AsyncSortContext <TValue> current);
private QuickSort(IEnumerable <TElement> source, AsyncSortContext <TElement> context) { this.elements = source.ToArray(); this.indexes = CreateIndexes(elements.Length); this.context = context; }
internal static async Task <IEnumerable <TElement> > Sort(IEnumerable <TElement> source, AsyncSortContext <TElement> context) { var sorter = new QuickSort <TElement>(source, context); await sorter.PerformSort().ConfigureAwait(false); var result = new TElement[sorter.indexes.Length]; for (var i = 0; i < sorter.indexes.Length; i++) { result[i] = sorter.elements[sorter.indexes[i]]; } return(result); }
protected AsyncSortContext(AsyncSortContext <TElement> childContext, bool descending) { this.childContext = childContext; this.descending = descending; }