Commit 79ee6a46 authored by Daniel Le Berre's avatar Daniel Le Berre

Fixes a few sonarqube violations.

parent f3c86d8b
......@@ -49,8 +49,8 @@ import org.sat4j.specs.VarMapper;
* @author leberre
* @since 2.1
*/
public abstract class BinaryClause implements Propagatable, Constr,
Serializable {
public abstract class BinaryClause
implements Propagatable, Constr, Serializable {
private static final long serialVersionUID = 1L;
......@@ -108,7 +108,8 @@ public abstract class BinaryClause implements Propagatable, Constr,
* @see Constr#simplify(Solver)
*/
public boolean simplify() {
if (this.voc.isSatisfied(this.head) || this.voc.isSatisfied(this.tail)) {
if (this.voc.isSatisfied(this.head)
|| this.voc.isSatisfied(this.tail)) {
return true;
}
return false;
......@@ -220,6 +221,9 @@ public abstract class BinaryClause implements Propagatable, Constr,
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
try {
BinaryClause wcl = (BinaryClause) obj;
if (wcl.head != this.head || wcl.tail != this.tail) {
......@@ -233,7 +237,7 @@ public abstract class BinaryClause implements Propagatable, Constr,
@Override
public int hashCode() {
long sum = this.head + this.tail;
long sum = (long) this.head + this.tail;
return (int) sum / 2;
}
......
......@@ -128,7 +128,8 @@ public abstract class HTClause implements Propagatable, Constr, Serializable {
* @see Constr#simplify(Solver)
*/
public boolean simplify() {
if (this.voc.isSatisfied(this.head) || this.voc.isSatisfied(this.tail)) {
if (this.voc.isSatisfied(this.head)
|| this.voc.isSatisfied(this.tail)) {
return true;
}
for (int middleLit : this.middleLits) {
......@@ -273,6 +274,8 @@ public abstract class HTClause implements Propagatable, Constr, Serializable {
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass())
return false;
try {
HTClause wcl = (HTClause) obj;
if (wcl.head != this.head || wcl.tail != this.tail) {
......@@ -302,7 +305,7 @@ public abstract class HTClause implements Propagatable, Constr, Serializable {
@Override
public int hashCode() {
long sum = this.head + this.tail;
long sum = (long) this.head + this.tail;
for (int p : this.middleLits) {
sum += p;
}
......
......@@ -245,6 +245,9 @@ public abstract class WLClause implements Propagatable, Constr, Serializable {
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
try {
WLClause wcl = (WLClause) obj;
if (this.lits.length != wcl.lits.length) {
......
......@@ -51,10 +51,10 @@ public class SizeComparator implements Comparator<Constr>, Serializable {
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
public int compare(Constr c1, Constr c2) {
long delta = c1.size() - c2.size();
int delta = c1.size() - c2.size();
if (delta == 0) {
return (int) Math.round(c2.getActivity() - c1.getActivity());
}
return (int) delta;
return delta;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment