/** * Appends to the <code>builder</code> the comparison of * two <code>short</code>s. * * @param lhs left-hand value * @param rhs right-hand value * @return this - used to chain append calls */ public CompareToBuilder append(final short lhs, final short rhs) { if (comparison != 0) { return this; } comparison = Short.compare(lhs, rhs); return this; }
@Override public int compare(Short o1, Short o2) { return Short.compare(o1, o2); }
@Override public int compareTo(ValueArray<ShortValue> o) { ShortValueArray other = (ShortValueArray) o; int min = Math.min(position, other.position); for (int i = 0; i < min; i++) { int cmp = Short.compare(data[i], other.data[i]); if (cmp != 0) { return cmp; } } return Integer.compare(position, other.position); }
/** * Compares this object to the specified short object to determine their * relative order. * * @param object * the short object to compare this object to. * @return a negative value if the value of this short is less than the * value of {@code object}; 0 if the value of this short and the * value of {@code object} are equal; a positive value if the value * of this short is greater than the value of {@code object}. * @throws NullPointerException * if {@code object} is null. * @see java.lang.Comparable * @since 1.2 */ public int compareTo(Short object) { return compare(value, object.value); }
/** * Compare arrays byte by byte, first byte is most significant. * If arrays have different length and the longer array share all bytes with the shorter array, then the longer one is larger, * unless ignoreLength is set to true in which case they are considered equal. */ static int lexicographicalUnsignedByteArrayCompare( byte[] a, int aLength, byte[] b, int bLength, boolean ignoreLength ) { assert a != null && b != null : "Null arrays not supported."; if ( a == b && aLength == bLength ) { return 0; } int length = Math.min( aLength, bLength ); for ( int i = 0; i < length; i++ ) { int compare = Short.compare( (short) (a[i] & 0xFF), (short) (b[i] & 0xFF) ); if ( compare != 0 ) { return compare; } } return ignoreLength ? 0 : Integer.compare( aLength, bLength ); }
@Override public int compareTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { // WARNING: the correctness of InCodeGenerator is dependent on the implementation of this // function being the equivalence of internal long representation. short leftValue = leftBlock.getShort(leftPosition, 0); short rightValue = rightBlock.getShort(rightPosition, 0); return Short.compare(leftValue, rightValue); }
@Override public int compareTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { // WARNING: the correctness of InCodeGenerator is dependent on the implementation of this // function being the equivalence of internal long representation. short leftValue = leftBlock.getShort(leftPosition, 0); short rightValue = rightBlock.getShort(rightPosition, 0); return Short.compare(leftValue, rightValue); }
@Override default int compare(T first, T second) { return Short.compare( applyAsShort(first), applyAsShort(second) ); }
@Override public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException { int firstCount = firstSource.readInt(); int secondCount = secondSource.readInt(); int minCount = Math.min(firstCount, secondCount); while (minCount-- > 0) { short firstValue = firstSource.readShort(); short secondValue = secondSource.readShort(); int cmp = Short.compare(firstValue, secondValue); if (cmp != 0) { return ascendingComparison ? cmp : -cmp; } } int cmp = Integer.compare(firstCount, secondCount); return ascendingComparison ? cmp : -cmp; }
@Override public int compare(EscherProperty p1, EscherProperty p2) { short s1 = p1.getPropertyNumber(); short s2 = p2.getPropertyNumber(); return Short.compare(s1, s2); } });
@Override public int compare(TimeZoneKey left, TimeZoneKey right) { return Short.compare(left.getKey(), right.getKey()); } }, TimeZoneKey.getTimeZoneKeys());
@Override public int compare(ENTITY first, ENTITY second) { requireNonNulls(first, second); final short a = field.getAsShort(first); final short b = field.getAsShort(second); return applyReversed(Short.compare(a, b)); }
@Override public int compare(T first, T second) { final boolean f = isNull(first); final boolean s = isNull(second); if (f && s) return 0; else if (f) return 1; else if (s) return -1; else return Short.compare( original.applyAsShort(first), original.applyAsShort(second) ); }
@Override public int compareTo(TShortBuffer other) { if (this == other) { return 0; } int sz = Math.min(remaining(), other.remaining()); int a = position; int b = other.position; for (int i = 0; i < sz; ++i) { int r = Short.compare(getElement(a++), other.getElement(b++)); if (r != 0) { return r; } } return Integer.compare(remaining(), other.remaining()); }
@Override default int compare(T first, T second) { if (isNull(first)) { return isNull(second) ? 0 : 1; } else if (isNull(second)) { return -1; } else { return Short.compare( applyAsShort(first), applyAsShort(second) ); } }
@Override public final int compare(final short a, final short b) { return -(Short.compare((a), (b))); } private Object readResolve() {
@Override public final int compare(final short a, final short b) { return (Short.compare((a), (b))); } private Object readResolve() {
private static int med3(final short x[], final int a, final int b, final int c) { final int ab = (Short.compare((x[a]), (x[b]))); final int ac = (Short.compare((x[a]), (x[c]))); final int bc = (Short.compare((x[b]), (x[c]))); return (ab < 0 ? (bc < 0 ? b : ac < 0 ? c : a) : (bc > 0 ? b : ac > 0 ? c : a)); }
private static int med3Indirect(final int perm[], final short x[], final int a, final int b, final int c) { final short aa = x[perm[a]]; final short bb = x[perm[b]]; final short cc = x[perm[c]]; final int ab = (Short.compare((aa), (bb))); final int ac = (Short.compare((aa), (cc))); final int bc = (Short.compare((bb), (cc))); return (ab < 0 ? (bc < 0 ? b : ac < 0 ? c : a) : (bc > 0 ? b : ac > 0 ? c : a)); }
private static long med3(final short x[][], final long a, final long b, final long c) { int ab = (Short.compare((get(x, a)), (get(x, b)))); int ac = (Short.compare((get(x, a)), (get(x, c)))); int bc = (Short.compare((get(x, b)), (get(x, c)))); return (ab < 0 ? (bc < 0 ? b : ac < 0 ? c : a) : (bc > 0 ? b : ac > 0 ? c : a)); }