Esempio n. 1
0
 internal EnumerableSorter(Func <TElement, TKey> keySelector, IComparer <TKey> comparer, bool descending, EnumerableSorter <TElement> next)
 {
     this.keySelector = keySelector;
     this.comparer    = comparer;
     this.descending  = descending;
     this.next        = next;
 }
        internal override EnumerableSorter <TElement> GetEnumerableSorter(EnumerableSorter <TElement> next)
        {
            EnumerableSorter <TElement> enumerableSorter = new EnumerableSorter <TElement, TKey>(this.keySelector, this.comparer, this.descending, next);

            if (this.parent != null)
            {
                enumerableSorter = this.parent.GetEnumerableSorter(enumerableSorter);
            }
            return(enumerableSorter);
        }
Esempio n. 3
0
            public IEnumerator <TElement> GetEnumerator()
            {
                Buffer <TElement> buffer = new Buffer <TElement>(source);

                if (buffer.count > 0)
                {
                    EnumerableSorter <TElement> sorter = GetEnumerableSorter(null);
                    int[] map = sorter.Sort(buffer.items, buffer.count);
                    sorter = null;
                    for (int i = 0; i < buffer.count; i++)
                    {
                        yield return(buffer.items[map[i]]);
                    }
                }
            }
Esempio n. 4
0
        public IEnumerator <TElement> GetEnumerator()
        {
            Buffer <TElement> buffer = new Buffer <TElement>(this.source);

            if (buffer.count > 0)
            {
                EnumerableSorter <TElement> enumerableSorter = this.GetEnumerableSorter(null);
                int[] array = enumerableSorter.Sort(buffer.items, buffer.count);
                enumerableSorter = null;
                for (int i = 0; i < buffer.count; i++)
                {
                    yield return(buffer.items[array[i]]);
                }
            }
            yield break;
        }
Esempio n. 5
0
 internal abstract EnumerableSorter <TElement> GetEnumerableSorter(EnumerableSorter <TElement> next);