You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2012/03/01 14:49:02 UTC
svn commit: r1295559 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java
Author: erans
Date: Thu Mar 1 13:49:01 2012
New Revision: 1295559
URL: http://svn.apache.org/viewvc?rev=1295559&view=rev
Log:
According to "FindBugs", negating the result of "compareTo" is bad
practice: Fixed.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java?rev=1295559&r1=1295558&r2=1295559&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/MathArrays.java Thu Mar 1 13:49:01 2012
@@ -160,17 +160,17 @@ public class MathArrays {
boolean strict) {
Comparable previous = val[0];
final int max = val.length;
- int comp;
for (int i = 1; i < max; i++) {
+ final int comp;
switch (dir) {
case INCREASING:
- comp = -val[i].compareTo(previous);
+ comp = previous.compareTo(val[i]);
if (strict) {
- if (0 <= comp) {
+ if (comp >= 0) {
return false;
}
} else {
- if ( comp > 0) {
+ if (comp > 0) {
return false;
}
}