Lint (psl-core). Resolved compareTo checks.
@@ -69,11 +69,11 @@ public abstract class GroundAtom extends Atom implements Comparable<GroundAtom>,
*/
@Override
public int compareTo(GroundAtom other) {
- if (this.getValue() < other.getValue()) {
- return 1;
- } else if (this.getValue() > other.getValue()) {
- return -1;
- } else {
+ int comparisonResult = Double.compare(other.value, this.value);
+ if (comparisonResult != 0) {
+ return comparisonResult;
+ }
+
int val = this.predicate.getName().compareTo(other.predicate.getName());
if (val != 0) {
return val;
@@ -89,4 +89,3 @@ public abstract class GroundAtom extends Atom implements Comparable<GroundAtom>,
return 0;
}
}
-}
