Commit b81e2bc5 authored by Daniel Le Berre's avatar Daniel Le Berre

Fix sonar violations.

parent 1c142032
......@@ -54,6 +54,7 @@ package org.sat4j.pb.reader;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
......@@ -230,12 +231,9 @@ public class OPBReader2007 extends OPBReader2006 {
if (rest != null && rest.indexOf("#product=") != -1) {
String[] splitted = rest.trim().split(" ");
if (splitted[0].equals("#product=")) {
Integer.parseInt(splitted[1]);
int nbproduct = Integer.parseInt(splitted[1]);
assert nbproduct >= 0;
}
// if (splitted[2].equals("sizeproduct="))
// readWord();
}
}
// callback to transmit the data
......@@ -264,8 +262,8 @@ public class OPBReader2007 extends OPBReader2006 {
// product => newSymbol (this is a clause)
// not x1 or not x2 ... or not xn or newSymbol
if (tmpLit.size() == 2) {
Map<String, String> map1 = this.binaryProductToVar.get(tmpLit
.get(0));
Map<String, String> map1 = this.binaryProductToVar
.get(tmpLit.get(0));
if (map1 == null) {
map1 = new HashMap<String, String>();
this.binaryProductToVar.put(tmpLit.get(0), map1);
......
......@@ -51,8 +51,8 @@ public class OPBReader2010 extends OPBReader2007 {
private BigInteger softLimit = SAT4J_MAX_BIG_INTEGER;
/**
*
*/
*
*/
private static final long serialVersionUID = 1L;
public OPBReader2010(IPBSolver solver) {
......@@ -104,12 +104,9 @@ public class OPBReader2010 extends OPBReader2007 {
if (rest != null && rest.indexOf("#product=") != -1) {
String[] splitted = rest.trim().split(" ");
if (splitted[0].equals("#product=")) {
Integer.parseInt(splitted[1]);
int nbproduct = Integer.parseInt(splitted[1]);
assert nbproduct >= 0;
}
// if (splitted[2].equals("sizeproduct="))
// readWord();
}
}
// callback to transmit the data
......@@ -159,8 +156,8 @@ public class OPBReader2010 extends OPBReader2007 {
throw new ParseFormatException(
"Expecting end of weight ");
}
BigInteger coeff = new BigInteger(s.substring(1,
s.length() - 1));
BigInteger coeff = new BigInteger(
s.substring(1, s.length() - 1));
getCoeffs().push(coeff);
int varId = this.nbNewSymbols++;
getVars().push(varId);
......@@ -177,7 +174,8 @@ public class OPBReader2010 extends OPBReader2007 {
if (this.softConstraint) {
int varId = getVars().last();
BigInteger constrWeight = this.d;
for (Iterator<BigInteger> it = this.coeffs.iterator(); it.hasNext();) {
for (Iterator<BigInteger> it = this.coeffs.iterator(); it
.hasNext();) {
constrWeight = constrWeight.add(it.next().abs());
}
if ("<=".equals(this.operator)) {
......
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