@Override public int compareTo(Object other) { return this.averageDepth.compareTo(((NodeBaryCentre) other).averageDepth); } }
@Override public int compare(Float o1, Float o2) { return o1.compareTo(o2); } }, Ordering.arbitrary());
@Override public int compareValues(Float first, Float second) { // Reversed intentionally because relevance by default // sorts descending: return second.compareTo(first); }
@Override public int compare(Object aObj, Object bObj) { Float a = (Float) aObj; Float b = (Float) bObj; return a.compareTo(b); }
/** * @return true if {@link #weight} has a value that is a valid number. */ public boolean isWeighted() { return this.weight.compareTo(1.0F) != 0; }
@Override public int compare(String depIndex1, String depIndex2) { return Float.valueOf(depIndex1).compareTo(Float.valueOf(depIndex2)); } }
@Override public int compare(Object aObj, Object bObj) { if (aObj instanceof Float && bObj instanceof Float) { Float a = (Float) aObj; Float b = (Float) bObj; return a.compareTo(b); } return super.compare(aObj, bObj); }
@Override public int compareTo(AcceptEncoding target) { return new Float(target.getQuality()).compareTo(getQuality()); } }
@Override public int compareTo(AcceptEncoding target) { return new Float(target.getQuality()).compareTo(getQuality()); } }
int result = valueFloat.compareTo((Float) propertyValue); switch (op) { case EQ:
public void testCompare() { for (float x : VALUES) { for (float y : VALUES) { // note: spec requires only that the sign is the same assertEquals(x + ", " + y, Float.valueOf(x).compareTo(y), Floats.compare(x, y)); } } }
int result = valueFloat.compareTo((Float) propertyValue); switch (op) { case EQ:
break; case FLOAT: compare = ((Float) thisVal).compareTo((Float) otherVal); break; case DOUBLE:
return ((Float) o1).compareTo((Float) o2);
return ((Float) first).compareTo((Float) second);
@Override public int compareTo(@Nullable SensorData other) { if (null == other) { return 1; } return value.compareTo(other.getValue()); }
if (tempVal.compareTo(new Float(0)) == 0) { primTypeFieldValueToUse.put(combined, tempVal); } else {
@SuppressWarnings("unchecked") @Override public int compareTo(Value that) { if (Value.isNull(that)) return 1; if ( this.isBoolean() && that.isBoolean() ) { return this.asBoolean().compareTo(that.asBoolean()); } if (this.isNumber() && that.isNumber()) { if (this.isLong()) return this.asLong().compareTo(that.asLong()); if (this.isDouble()) return this.asDouble().compareTo(that.asDouble()); if (this.isInteger()) return this.asInteger().compareTo(that.asInteger()); if (this.isFloat()) return this.asFloat().compareTo(that.asFloat()); if (this.isBigDecimal()) return this.asBigDecimal().compareTo(that.asBigDecimal()); return this.asBigInteger().compareTo(that.asBigInteger()); } if ( this.isDocument() && that.isDocument()) { return this.asDocument().compareTo(that.asDocument()); } if ( this.isArray() && that.isArray() ) { return this.asArray().compareTo(that.asArray()); } Comparable<Object> thisValue = (Comparable<Object>)this.asObject(); Comparable<Object> thatValue = (Comparable<Object>)((ComparableValue)that.comparable()).asObject(); if ( thisValue.getClass().isAssignableFrom(thatValue.getClass())) { return thisValue.compareTo(thatValue); } else if (thatValue.getClass().isAssignableFrom(thisValue.getClass())) { return thatValue.compareTo(thisValue) * -1; // correct for the reversed comparison } return ((Comparable<Object>) this.value).compareTo(that.asObject()); }