private int compareValues(Value a, Value b, int sortType) { if (a == b) { return 0; } // null is never stored; // comparison with null is used to retrieve all entries // in which case null is always lower than all entries // (even for descending ordered indexes) if (a == null) { return -1; } else if (b == null) { return 1; } boolean aNull = a == ValueNull.INSTANCE; boolean bNull = b == ValueNull.INSTANCE; if (aNull || bNull) { return SortOrder.compareNull(aNull, sortType); } int comp = a.compareTypeSafe(b, compareMode); if ((sortType & SortOrder.DESCENDING) != 0) { comp = -comp; } return comp; }
/** * Compare two expression lists. * * @param a the first expression list * @param b the second expression list * @return the result of the comparison */ @Override public int compare(Value[] a, Value[] b) { for (int i = 0, len = queryColumnIndexes.length; i < len; i++) { int idx = queryColumnIndexes[i]; int type = sortTypes[i]; Value ao = a[idx]; Value bo = b[idx]; boolean aNull = ao == ValueNull.INSTANCE, bNull = bo == ValueNull.INSTANCE; if (aNull || bNull) { if (aNull == bNull) { continue; } return compareNull(aNull, type); } int comp = database.compare(ao, bo); if (comp != 0) { return (type & DESCENDING) == 0 ? comp : -comp; } } return 0; }
private int compareValues(Value a, Value b, int sortType) throws SQLException { boolean aNull = a == null, bNull = b == null; if (aNull || bNull) { if (aNull == bNull) { return 0; } return SortOrder.compareNull(aNull, bNull, sortType); } int comp = database.compareTypeSave(a, b); if ((sortType & SortOrder.DESCENDING) != 0) { comp = -comp; } return comp; }
public int compare(Value[] a, Value[] b) throws SQLException { for (int i = 0; i < len; i++) { int idx = indexes[i]; int type = sortTypes[i]; Value ao = a[idx]; Value bo = b[idx]; boolean aNull = ao == ValueNull.INSTANCE, bNull = bo == ValueNull.INSTANCE; if (aNull || bNull) { if (aNull == bNull) { continue; } return compareNull(aNull, bNull, type); } int comp = database.compare(ao, bo); if (comp != 0) { return (type & DESCENDING) == 0 ? comp : -comp; } } return 0; }
private int compareValues(Value a, Value b, int sortType) { if (a == b) { return 0; } // null is never stored; // comparison with null is used to retrieve all entries // in which case null is always lower than all entries // (even for descending ordered indexes) if (a == null) { return -1; } else if (b == null) { return 1; } boolean aNull = a == ValueNull.INSTANCE; boolean bNull = b == ValueNull.INSTANCE; if (aNull || bNull) { return SortOrder.compareNull(aNull, sortType); } int comp = a.compareTypeSafe(b, compareMode); if ((sortType & SortOrder.DESCENDING) != 0) { comp = -comp; } return comp; }
private int compareValues(Value a, Value b, int sortType) { if (a == b) { return 0; } // null is never stored; // comparison with null is used to retrieve all entries // in which case null is always lower than all entries // (even for descending ordered indexes) if (a == null) { return -1; } else if (b == null) { return 1; } boolean aNull = a == ValueNull.INSTANCE; boolean bNull = b == ValueNull.INSTANCE; if (aNull || bNull) { return SortOrder.compareNull(aNull, sortType); } int comp = a.compareTypeSafe(b, compareMode); if ((sortType & SortOrder.DESCENDING) != 0) { comp = -comp; } return comp; }
/** * Compare two expression lists. * * @param a the first expression list * @param b the second expression list * @return the result of the comparison */ @Override public int compare(Value[] a, Value[] b) { for (int i = 0, len = queryColumnIndexes.length; i < len; i++) { int idx = queryColumnIndexes[i]; int type = sortTypes[i]; Value ao = a[idx]; Value bo = b[idx]; boolean aNull = ao == ValueNull.INSTANCE, bNull = bo == ValueNull.INSTANCE; if (aNull || bNull) { if (aNull == bNull) { continue; } return compareNull(aNull, type); } int comp = database.compare(ao, bo); if (comp != 0) { return (type & DESCENDING) == 0 ? comp : -comp; } } return 0; }
/** * Compare two expression lists. * * @param a the first expression list * @param b the second expression list * @return the result of the comparison */ @Override public int compare(Value[] a, Value[] b) { for (int i = 0, len = queryColumnIndexes.length; i < len; i++) { int idx = queryColumnIndexes[i]; int type = sortTypes[i]; Value ao = a[idx]; Value bo = b[idx]; boolean aNull = ao == ValueNull.INSTANCE, bNull = bo == ValueNull.INSTANCE; if (aNull || bNull) { if (aNull == bNull) { continue; } return compareNull(aNull, type); } int comp = database.compare(ao, bo); if (comp != 0) { return (type & DESCENDING) == 0 ? comp : -comp; } } return 0; }