public override IComparer <T> BuildSortComparer <T>(SortCriteria sortCriteria)
#if DEBUG
        {
            return(sortCriteria == null
                                ? throw new ArgumentNullException(nameof(sortCriteria))
                                : new DelegateComparer <T>(SortComparerFactory <T> .BuildComparerFunc(sortCriteria)));
        }
Esempio n. 2
0
        public static int CompareValueType(Thing x, Thing y)
        {
            int?valueX = ((SwampThing)x).License;
            int?valueY = ((SpaceThing)y).License;

            if (!SortComparerFactory.TryEnsureValidValues(valueX.HasValue, valueY.HasValue, out int valueComparisonResult))
            {
                return(valueComparisonResult);
            }

            return(valueX.Value.CompareTo(valueY.Value));
        }
Esempio n. 3
0
        public static int CompareReferenceType(Thing x)
        {
            string?valueX = x.Text;
            string?valueY = null;

            if (!SortComparerFactory.TryEnsureValidReferences(valueX, valueY, out int referenceComparisonResult))
            {
                return(referenceComparisonResult);
            }

            return(valueX.CompareTo(valueY));
        }
Esempio n. 4
0
        public static int CompareEnumType(Thing x, Thing y)
        {
            long?valueX = (long)x.Day;
            long?valueY = (long)y.Day;

            if (!SortComparerFactory.TryEnsureValidValues(valueX.HasValue, valueY.HasValue, out int valueComparisonResult))
            {
                return(valueComparisonResult);
            }

            return(valueX.Value.CompareTo(valueY));
        }
Esempio n. 5
0
        public static int CompareValueTypeNoGetter()
        {
            int?valueX = null;
            int?valueY = null;

            if (!SortComparerFactory.TryEnsureValidValues(valueX.HasValue, valueY.HasValue, out int valueComparisonResult))
            {
                return(valueComparisonResult);
            }

            return(valueX.Value.CompareTo(valueY.Value));
        }
Esempio n. 6
0
        public static int CompareValueBaseType(Thing x, Thing y)
        {
            int?valueX = x.Id;
            int?valueY = y.Id;

            if (!SortComparerFactory.TryEnsureValidValues(valueX.HasValue, valueY.HasValue, out int valueComparisonResult))
            {
                return(valueComparisonResult);
            }

            return(valueX.Value.CompareTo(valueY.Value));
        }
Esempio n. 7
0
 public int Compare(T x, T y)
 {
     return(!SortComparerFactory.TryEnsureValidReferences(x, y, out int referenceComparisonResult)
                         ? referenceComparisonResult
                         : _CompareFunc.Invoke(x, y));
 }