@Override public int getSignum() { return Integer.signum(value); }
@Override public int getSignum() { return Integer.signum(ordinal); }
@Override public int getSignum() { return Integer.signum(value); }
@Override public int getSignum() { return Integer.signum(value); }
@Override public boolean matchesSafely(T actual) { int compare = signum(actual.compareTo(expected)); return minCompare <= compare && compare <= maxCompare; }
Collections.sort(list, new Comparator<String>() { public int compare(String a, String b) { return Integer.signum(fixString(a) - fixString(b)); } private int fixString(String in) { return Integer.parseInt(in.substring(0, in.indexOf('_'))); } });
private static void runTestFuzzyCompare(int toleranceIndex) { double tolerance = get(TOLERANCE_CANDIDATES, toleranceIndex); for (double a : ALL_DOUBLE_CANDIDATES) { for (double b : ALL_DOUBLE_CANDIDATES) { int expected = DoubleMath.fuzzyEquals(a, b, tolerance) ? 0 : Double.compare(a, b); int actual = DoubleMath.fuzzyCompare(a, b, tolerance); assertEquals(Integer.signum(expected), Integer.signum(actual)); } } }
@Override public int compare(Object aObj, Object bObj) { AutoDetectDataType aType = getType(aObj); AutoDetectDataType bType = getType(bObj); int typeDiff = aType.typeId - bType.typeId; if (typeDiff == 0) { return aType.compare(aObj, bObj); } return Integer.signum(typeDiff); }
/** * Return true when the next encoded value in {@code src} uses Numeric * encoding and is {@code NaN}, false otherwise. */ public static boolean isNumericNaN(PositionedByteRange src) { return NAN == (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek()); }
/** * Return true when the next encoded value in {@code src} uses fixed-width * Int32 encoding, false otherwise. */ public static boolean isFixedInt32(PositionedByteRange src) { return FIXED_INT32 == (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek()); }
/** * Return true when the next encoded value in {@code src} uses BlobVar * encoding, false otherwise. */ public static boolean isBlobVar(PositionedByteRange src) { return BLOB_VAR == (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek()); }
/** * Return true when the next encoded value in {@code src} uses Numeric * encoding, false otherwise. {@code NaN}, {@code +/-Inf} are valid Numeric * values. */ public static boolean isNumeric(PositionedByteRange src) { byte x = (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek()); return x >= NEG_INF && x <= NAN; }
/** * Return true when the next encoded value in {@code src} uses Numeric * encoding and is {@code Infinite}, false otherwise. */ public static boolean isNumericInfinite(PositionedByteRange src) { byte x = (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek()); return NEG_INF == x || POS_INF == x; }
/** * Return true when the next encoded value in {@code src} uses fixed-width * Int8 encoding, false otherwise. */ public static boolean isFixedInt8(PositionedByteRange src) { return FIXED_INT8 == (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek()); }
/** * Return true when the next encoded value in {@code src} uses BlobCopy * encoding, false otherwise. */ public static boolean isBlobCopy(PositionedByteRange src) { return BLOB_COPY == (-1 == Integer.signum(src.peek()) ? DESCENDING : ASCENDING).apply(src.peek()); }
@Override protected int compareSecure(Value v, CompareMode mode) { if (type == Value.CLOB) { return Integer.signum(getString().compareTo(v.getString())); } byte[] v2 = v.getBytesNoCopy(); return Bits.compareNotNullSigned(getBytesNoCopy(), v2); }
/** * {@inheritDoc} */ public int compareTo(ClassFileVersion other) { return Integer.signum(getMajorVersion() == other.getMajorVersion() ? getMinorVersion() - other.getMinorVersion() : getMajorVersion() - other.getMajorVersion()); }