List of usage examples for org.apache.commons.lang NumberUtils compare
public static int compare(float lhs, float rhs)
Compares two floats for order.
This method is more comprehensive than the standard Java greater than, less than and equals operators.
-1
if the first value is less than the second. From source file:org.sonar.api.measures.RangeDistributionBuilder.java
private void changeDoublesToInts() { boolean onlyInts = true; for (Number bottomLimit : bottomLimits) { if (NumberUtils.compare(bottomLimit.intValue(), bottomLimit.doubleValue()) != 0) { onlyInts = false;/*from ww w . j a v a2 s .c o m*/ } } if (onlyInts) { for (int i = 0; i < bottomLimits.length; i++) { bottomLimits[i] = bottomLimits[i].intValue(); } } }
From source file:org.sonar.api.measures.RangeDistributionBuilder.java
private RangeDistributionBuilder addLimitCount(Number limit, int count) { for (Number bottomLimit : bottomLimits) { if (NumberUtils.compare(bottomLimit.doubleValue(), limit.doubleValue()) == 0) { this.countBag.add(limit, count); isEmpty = false;//from ww w .ja v a 2 s. co m return this; } } isValid = false; return this; }
From source file:org.sonar.api.measures.RangeDistributionBuilder.java
private static boolean greaterOrEqualsThan(Number n1, Number n2) { return NumberUtils.compare(n1.doubleValue(), n2.doubleValue()) >= 0; }