Example #1
0
            public MultiComparatorsFieldValueHitQueue(SortField[] fields, int size) : base(fields)
            {
                int numComparators = comparators.Length;

                for (int i = 0; i < numComparators; ++i)
                {
                    SortField field = fields[i];

                    // AUTO is resolved before we are called
                    System.Diagnostics.Debug.Assert(field.GetType() != SortField.AUTO);

                    reverseMul[i]  = field.reverse?-1:1;
                    comparators[i] = field.GetComparator(size, i);
                }

                Initialize(size);
            }
Example #2
0
            public OneComparatorFieldValueHitQueue(SortField[] fields, int size) : base(fields)
            {
                if (fields.Length == 0)
                {
                    throw new System.ArgumentException("Sort must contain at least one field");
                }

                SortField field = fields[0];

                // AUTO is resolved before we are called
                System.Diagnostics.Debug.Assert(field.GetType() != SortField.AUTO);
                comparator    = field.GetComparator(size, 0);
                oneReverseMul = field.reverse?-1:1;

                comparators[0] = comparator;
                reverseMul[0]  = oneReverseMul;

                Initialize(size);
            }