public override bool Matches(DataSchema dataSchema, Type columnType, object columnValue, object operandValue) { if (columnValue == null) { return(false); } columnValue = Convert.ChangeType(columnValue, GetTypeToConvertOperandTo(dataSchema, columnType)); return(ComparisonMatches(dataSchema.Compare(columnValue, operandValue))); }
public static Comparison<RowKey> GetComparison(DataSchema dataSchema, IEnumerable<IdentifierPath> keys) { var sortedKeys = keys.ToArray(); Array.Sort(sortedKeys); return (rowKey1, rowKey2) => { foreach (var key in sortedKeys) { var result = dataSchema.Compare(rowKey1.FindValue(key), rowKey2.FindValue(key)); if (result != 0) { return result; } } return 0; }; }
public int CompareTo(SortRow other) { for (int i = 0; i < Sorts.Count; i++) { var sort = Sorts[i]; int result = DataSchema.Compare(_keys[i], other._keys[i]); if (sort.SortDirection == ListSortDirection.Descending) { result = -result; } if (result != 0) { return(result); } } return(OriginalRowIndex.CompareTo(other.OriginalRowIndex)); }
public int Compare(PivotKey x, PivotKey y) { // ReSharper disable PossibleNullReferenceException if (x.Length == 0) { return(y.Length == 0 ? 0 : -1); } if (y.Length == 0) { return(1); } if (x.Length > y.Length) { int result = Compare(x.Parent, y); if (result != 0) { return(result); } return(1); } else if (x.Length < y.Length) { int result = Compare(x, y.Parent); if (result != 0) { return(result); } return(-1); } else { int result = Compare(x.Parent, y.Parent); if (result != 0) { return(result); } result = x.PropertyPath.CompareTo(y.PropertyPath); if (result != 0) { return(result); } return(_dataSchema.Compare(x.Value, y.Value)); } // ReSharper restore PossibleNullReferenceException }
public static Comparison <RowKey> GetComparison(DataSchema dataSchema, IEnumerable <IdentifierPath> keys) { var sortedKeys = keys.ToArray(); Array.Sort(sortedKeys); return((rowKey1, rowKey2) => { foreach (var key in sortedKeys) { var result = dataSchema.Compare(rowKey1.FindValue(key), rowKey2.FindValue(key)); if (result != 0) { return result; } } return 0; }); }
public int Compare(PivotKey x, PivotKey y) { if (x.Length == 0) { return(y.Length == 0 ? 0 : -1); } if (y.Length == 0) { return(1); } if (x.Length > y.Length) { int result = Compare(x.Parent, y); if (result != 0) { return(result); } return(1); } else if (x.Length < y.Length) { int result = Compare(x, y.Parent); if (result != 0) { return(result); } return(-1); } else { int result = Compare(x.Parent, y.Parent); if (result != 0) { return(result); } result = x.PropertyPath.CompareTo(y.PropertyPath); if (result != 0) { return(result); } return(_dataSchema.Compare(x.Value, y.Value)); } }