public int Compare(MultiKeyUntyped firstValues, MultiKeyUntyped secondValues) { if (firstValues.Count != _isDescendingValues.Length || secondValues.Count != _isDescendingValues.Length) { throw new ArgumentException("Incompatible size MultiKey sizes for comparison"); } for (int i = 0; i < firstValues.Count; i++) { var valueOne = firstValues.Get(i); var valueTwo = secondValues.Get(i); var isDescending = _isDescendingValues[i]; if (!_stringTypedValue[i]) { int comparisonResult = MultiKeyComparator.CompareValues(valueOne, valueTwo, isDescending); if (comparisonResult != 0) { return(comparisonResult); } } else { int comparisonResult = MultiKeyComparator.CompareValues(valueOne, valueTwo, isDescending, _stringComparison); if (comparisonResult != 0) { return(comparisonResult); } } } // Make the comparator compatible with equals return(!Equals(firstValues, secondValues) ? -1 : 0); }
public int Compare(Object firstValue, Object secondValue) { return(MultiKeyComparator.CompareValues(firstValue, secondValue, _isDescendingValue)); }