/** * Compare two values with the current comparison mode. The values must be * of the same type. * * @param a the first value * @param b the second value * @return 0 if both values are equal, -1 if the first value is smaller, and * 1 otherwise */ public int compareTypeSafe(Value a, Value b) { return a.compareTypeSafe(b, compareMode); }
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; }
/** * @param v1 First value. * @param v2 Second value. * @return {@code true} If they equal. */ private boolean equal(Value v1, Value v2) { return v1 == v2 || (v1 != null && v2 != null && v1.compareTypeSafe(v2, idx.getDatabase().getCompareMode()) == 0); }
/** * Compare two values with the current comparison mode. The values may be of * different type. * * @param a the first value * @param b the second value * @return 0 if both values are equal, -1 if the first value is smaller, and * 1 otherwise */ public int compareTypeSafe(Value a, Value b) { if (a == b) { return 0; } int dataType = Value.getHigherOrder(a.getType(), b.getType()); a = a.convertTo(dataType); b = b.convertTo(dataType); return a.compareTypeSafe(b, compareMode); }
/** */ private boolean getRes(InlineIndexHelper ha, String s1, String s2) { Value v1 = s1 == null ? ValueNull.INSTANCE : ValueString.get(s1); Value v2 = s2 == null ? ValueNull.INSTANCE : ValueString.get(s2); int c = v1.compareTypeSafe(v2, CompareMode.getInstance(null, 0)); return ha.canRelyOnCompare(c, v1, v2); }
/** */ private boolean getResBytes(InlineIndexHelper ha, byte[] b1, byte[] b2) { Value v1 = b1 == null ? ValueNull.INSTANCE : ValueBytes.get(b1); Value v2 = b2 == null ? ValueNull.INSTANCE : ValueBytes.get(b2); int c = v1.compareTypeSafe(v2, CompareMode.getInstance(null, 0)); return ha.canRelyOnCompare(c, v1, v2); }
/** */ private boolean getResJavaObjects(InlineIndexHelper ha, Object o1, Object o2) { Value v1 = o1 == null ? ValueNull.INSTANCE : ValueJavaObject.getNoCopy(null, SerializationUtils.serialize(o1), null); Value v2 = o2 == null ? ValueNull.INSTANCE : ValueJavaObject.getNoCopy(null, SerializationUtils.serialize(o2), null); int c = v1.compareTypeSafe(v2, CompareMode.getInstance(null, 0)); return ha.canRelyOnCompare(c, v1, v2); }
/** * Compare two values with the current comparison mode. The values must be * of the same type. * * @param a the first value * @param b the second value * @return 0 if both values are equal, -1 if the first value is smaller, and * 1 otherwise */ public int compareTypeSafe(Value a, Value b) { return a.compareTypeSafe(b, compareMode); }
/** * Compare two values with the current comparison mode. The values must be * of the same type. * * @param a the first value * @param b the second value * @return 0 if both values are equal, -1 if the first value is smaller, and * 1 otherwise */ public int compareTypeSafe(Value a, Value b) { return a.compareTypeSafe(b, compareMode); }
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; }
/** * @param v1 First value. * @param v2 Second value. * @return {@code true} If they equal. */ private boolean equal(Value v1, Value v2) { return v1 == v2 || (v1 != null && v2 != null && v1.compareTypeSafe(v2, getDatabase().getCompareMode()) == 0); }
/** * Compare two values with the current comparison mode. The values may be of * different type. * * @param a the first value * @param b the second value * @return 0 if both values are equal, -1 if the first value is smaller, and * 1 otherwise */ public int compareTypeSafe(Value a, Value b) { if (a == b) { return 0; } int dataType = Value.getHigherOrder(a.getType(), b.getType()); a = a.convertTo(dataType); b = b.convertTo(dataType); return a.compareTypeSafe(b, compareMode); }
/** * Compare two values with the current comparison mode. The values may be of * different type. * * @param a the first value * @param b the second value * @return 0 if both values are equal, -1 if the first value is smaller, and * 1 otherwise */ public int compareTypeSafe(Value a, Value b) { if (a == b) { return 0; } int dataType = Value.getHigherOrder(a.getType(), b.getType()); a = a.convertTo(dataType); b = b.convertTo(dataType); return a.compareTypeSafe(b, compareMode); }