Fixed findbugs warnings.

The warnings were related to compareTo implementations not handling -0.0
or NaN properly (cf
<http://findbugs.sourceforge.net/bugDescriptions.html#CO_COMPARETO_INCORRECT_FLOATING>).
This commit is contained in:
Luc Maisonobe 2015-11-03 12:21:08 +01:00
parent 9672399666
commit be8563a6c5
3 changed files with 27 additions and 18 deletions

View File

@ -260,22 +260,25 @@ public class GaussianCurveFitter extends AbstractCurveFitter {
if (p2 == null) {
return 1;
}
if (p1.getX() < p2.getX()) {
final int cmpX = Double.compare(p1.getX(), p2.getX());
if (cmpX < 0) {
return -1;
}
if (p1.getX() > p2.getX()) {
if (cmpX > 0) {
return 1;
}
if (p1.getY() < p2.getY()) {
final int cmpY = Double.compare(p1.getY(), p2.getY());
if (cmpY < 0) {
return -1;
}
if (p1.getY() > p2.getY()) {
if (cmpY > 0) {
return 1;
}
if (p1.getWeight() < p2.getWeight()) {
final int cmpW = Double.compare(p1.getWeight(), p2.getWeight());
if (cmpW < 0) {
return -1;
}
if (p1.getWeight() > p2.getWeight()) {
if (cmpW > 0) {
return 1;
}
return 0;

View File

@ -194,22 +194,25 @@ public class GaussianFitter extends CurveFitter<Gaussian.Parametric> {
if (p2 == null) {
return 1;
}
if (p1.getX() < p2.getX()) {
final int cmpX = Double.compare(p1.getX(), p2.getX());
if (cmpX < 0) {
return -1;
}
if (p1.getX() > p2.getX()) {
if (cmpX > 0) {
return 1;
}
if (p1.getY() < p2.getY()) {
final int cmpY = Double.compare(p1.getY(), p2.getY());
if (cmpY < 0) {
return -1;
}
if (p1.getY() > p2.getY()) {
if (cmpY > 0) {
return 1;
}
if (p1.getWeight() < p2.getWeight()) {
final int cmpW = Double.compare(p1.getWeight(), p2.getWeight());
if (cmpW < 0) {
return -1;
}
if (p1.getWeight() > p2.getWeight()) {
if (cmpW > 0) {
return 1;
}
return 0;

View File

@ -195,22 +195,25 @@ public class GaussianFitter extends CurveFitter<Gaussian.Parametric> {
if (p2 == null) {
return 1;
}
if (p1.getX() < p2.getX()) {
final int cmpX = Double.compare(p1.getX(), p2.getX());
if (cmpX < 0) {
return -1;
}
if (p1.getX() > p2.getX()) {
if (cmpX > 0) {
return 1;
}
if (p1.getY() < p2.getY()) {
final int cmpY = Double.compare(p1.getY(), p2.getY());
if (cmpY < 0) {
return -1;
}
if (p1.getY() > p2.getY()) {
if (cmpY > 0) {
return 1;
}
if (p1.getWeight() < p2.getWeight()) {
final int cmpW = Double.compare(p1.getWeight(), p2.getWeight());
if (cmpW < 0) {
return -1;
}
if (p1.getWeight() > p2.getWeight()) {
if (cmpW > 0) {
return 1;
}
return 0;