Commit 42d1e639 authored by Daniel Le Berre's avatar Daniel Le Berre

StringBuffer -> StringBuilder.

parent 9aed674b
Pipeline #83 passed with stage
in 11 minutes and 40 seconds
...@@ -63,7 +63,7 @@ public class AraliaParser { ...@@ -63,7 +63,7 @@ public class AraliaParser {
@Override @Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(this.nodeType.getPrefix()); sb.append(this.nodeType.getPrefix());
if (this.nodeType == LogicFormulaNodeType.TERM) { if (this.nodeType == LogicFormulaNodeType.TERM) {
sb.append(this.label); sb.append(this.label);
...@@ -177,7 +177,7 @@ public class AraliaParser { ...@@ -177,7 +177,7 @@ public class AraliaParser {
private LogicFormulaNode readTerm(String s) { private LogicFormulaNode readTerm(String s) {
LogicFormulaNode node = new LogicFormulaNode(LogicFormulaNodeType.TERM); LogicFormulaNode node = new LogicFormulaNode(LogicFormulaNodeType.TERM);
StringBuffer label = new StringBuffer(); StringBuilder label = new StringBuilder();
for (char c : s.toCharArray()) { for (char c : s.toCharArray()) {
if ((c != '(') && (c != ')')) { if ((c != '(') && (c != ')')) {
label.append(c); label.append(c);
......
...@@ -200,7 +200,7 @@ public class Br4cpAraliaReader { ...@@ -200,7 +200,7 @@ public class Br4cpAraliaReader {
private String removeSpaces(String line) { private String removeSpaces(String line) {
char[] chars = line.toCharArray(); char[] chars = line.toCharArray();
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < chars.length; ++i) { for (int i = 0; i < chars.length; ++i) {
if (chars[i] != ' ') { if (chars[i] != ' ') {
sb.append(chars[i]); sb.append(chars[i]);
......
...@@ -32,7 +32,7 @@ public class Options { ...@@ -32,7 +32,7 @@ public class Options {
} }
public void parseCommandLine(String args[]) { public void parseCommandLine(String args[]) {
StringBuffer errBuff = new StringBuffer(); StringBuilder errBuff = new StringBuilder();
for (String arg : args) { for (String arg : args) {
if (arg.startsWith("-")) { if (arg.startsWith("-")) {
try { try {
......
...@@ -82,7 +82,7 @@ public abstract class AbstractLauncher implements Serializable, ILogAble { ...@@ -82,7 +82,7 @@ public abstract class AbstractLauncher implements Serializable, ILogAble {
protected transient PrintWriter out = new PrintWriter(System.out, true); protected transient PrintWriter out = new PrintWriter(System.out, true);
private StringBuffer logBuffer; private StringBuilder logBuffer;
private boolean displaySolutionLine = true; private boolean displaySolutionLine = true;
...@@ -429,7 +429,7 @@ public abstract class AbstractLauncher implements Serializable, ILogAble { ...@@ -429,7 +429,7 @@ public abstract class AbstractLauncher implements Serializable, ILogAble {
} }
protected void bufferizeLog() { protected void bufferizeLog() {
this.logBuffer = new StringBuffer(); this.logBuffer = new StringBuilder();
} }
protected void flushLog() { protected void flushLog() {
......
...@@ -342,7 +342,7 @@ public final class Vec<T> implements IVec<T> { ...@@ -342,7 +342,7 @@ public final class Vec<T> implements IVec<T> {
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int i = 0; i < this.nbelem - 1; i++) { for (int i = 0; i < this.nbelem - 1; i++) {
stb.append(this.myarray[i]); stb.append(this.myarray[i]);
stb.append(","); //$NON-NLS-1$ stb.append(","); //$NON-NLS-1$
......
...@@ -348,7 +348,7 @@ public final class VecInt implements IVecInt { ...@@ -348,7 +348,7 @@ public final class VecInt implements IVecInt {
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int i = 0; i < this.nbelem - 1; i++) { for (int i = 0; i < this.nbelem - 1; i++) {
stb.append(this.myarray[i]); stb.append(this.myarray[i]);
stb.append(","); //$NON-NLS-1$ stb.append(","); //$NON-NLS-1$
......
...@@ -309,7 +309,7 @@ public class AtLeast implements Propagatable, Constr, Undoable, Serializable { ...@@ -309,7 +309,7 @@ public class AtLeast implements Propagatable, Constr, Undoable, Serializable {
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
stb.append("Card (" + this.lits.length + ") : "); stb.append("Card (" + this.lits.length + ") : ");
for (int lit : this.lits) { for (int lit : this.lits) {
// if (voc.isUnassigned(lits[i])) { // if (voc.isUnassigned(lits[i])) {
...@@ -413,7 +413,7 @@ public class AtLeast implements Propagatable, Constr, Undoable, Serializable { ...@@ -413,7 +413,7 @@ public class AtLeast implements Propagatable, Constr, Undoable, Serializable {
} }
public String toString(VarMapper mapper) { public String toString(VarMapper mapper) {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int lit : this.lits) { for (int lit : this.lits) {
stb.append(" + "); //$NON-NLS-1$ stb.append(" + "); //$NON-NLS-1$
stb.append(mapper.map(LiteralsUtils.toDimacs(lit))); stb.append(mapper.map(LiteralsUtils.toDimacs(lit)));
......
...@@ -374,7 +374,7 @@ public final class MaxWatchCard ...@@ -374,7 +374,7 @@ public final class MaxWatchCard
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
if (this.lits.length > 0) { if (this.lits.length > 0) {
if (this.voc.isUnassigned(this.lits[0])) { if (this.voc.isUnassigned(this.lits[0])) {
...@@ -509,7 +509,7 @@ public final class MaxWatchCard ...@@ -509,7 +509,7 @@ public final class MaxWatchCard
} }
public String toString(VarMapper mapper) { public String toString(VarMapper mapper) {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
if (this.lits.length > 0) { if (this.lits.length > 0) {
if (this.voc.isUnassigned(this.lits[0])) { if (this.voc.isUnassigned(this.lits[0])) {
......
...@@ -438,7 +438,7 @@ public class MinWatchCard ...@@ -438,7 +438,7 @@ public class MinWatchCard
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
// stb.append("Card (" + this.lits.length + ") : "); // stb.append("Card (" + this.lits.length + ") : ");
if (this.lits.length > 0) { if (this.lits.length > 0) {
// if (voc.isUnassigned(lits[0])) { // if (voc.isUnassigned(lits[0])) {
...@@ -734,7 +734,7 @@ public class MinWatchCard ...@@ -734,7 +734,7 @@ public class MinWatchCard
if (mapper == null) { if (mapper == null) {
return toString(); return toString();
} }
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
// stb.append("Card (" + this.lits.length + ") : "); // stb.append("Card (" + this.lits.length + ") : ");
if (this.lits.length > 0) { if (this.lits.length > 0) {
// if (voc.isUnassigned(lits[0])) { // if (voc.isUnassigned(lits[0])) {
......
...@@ -151,7 +151,7 @@ public abstract class BinaryClause implements Propagatable, Constr, ...@@ -151,7 +151,7 @@ public abstract class BinaryClause implements Propagatable, Constr,
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
stb.append(Lits.toString(this.head)); stb.append(Lits.toString(this.head));
stb.append("["); //$NON-NLS-1$ stb.append("["); //$NON-NLS-1$
stb.append(this.voc.valueToString(this.head)); stb.append(this.voc.valueToString(this.head));
...@@ -283,7 +283,7 @@ public abstract class BinaryClause implements Propagatable, Constr, ...@@ -283,7 +283,7 @@ public abstract class BinaryClause implements Propagatable, Constr,
if (mapper == null) { if (mapper == null) {
return toString(); return toString();
} }
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
stb.append(mapper.map(LiteralsUtils.toDimacs(this.head))); stb.append(mapper.map(LiteralsUtils.toDimacs(this.head)));
stb.append("["); //$NON-NLS-1$ stb.append("["); //$NON-NLS-1$
stb.append(this.voc.valueToString(this.head)); stb.append(this.voc.valueToString(this.head));
......
...@@ -259,7 +259,7 @@ public class CBClause implements Constr, Undoable, Propagatable, Serializable { ...@@ -259,7 +259,7 @@ public class CBClause implements Constr, Undoable, Propagatable, Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int i = 0; i < lits.length; i++) { for (int i = 0; i < lits.length; i++) {
stb.append(lits[i]); stb.append(lits[i]);
stb.append("["); //$NON-NLS-1$ stb.append("["); //$NON-NLS-1$
......
...@@ -194,7 +194,7 @@ public abstract class HTClause implements Propagatable, Constr, Serializable { ...@@ -194,7 +194,7 @@ public abstract class HTClause implements Propagatable, Constr, Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
stb.append(Lits.toString(this.head)); stb.append(Lits.toString(this.head));
stb.append("["); //$NON-NLS-1$ stb.append("["); //$NON-NLS-1$
stb.append(this.voc.valueToString(this.head)); stb.append(this.voc.valueToString(this.head));
...@@ -351,7 +351,7 @@ public abstract class HTClause implements Propagatable, Constr, Serializable { ...@@ -351,7 +351,7 @@ public abstract class HTClause implements Propagatable, Constr, Serializable {
} }
public String toString(VarMapper mapper) { public String toString(VarMapper mapper) {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
stb.append(mapper.map(LiteralsUtils.toDimacs(this.head))); stb.append(mapper.map(LiteralsUtils.toDimacs(this.head)));
stb.append("["); //$NON-NLS-1$ stb.append("["); //$NON-NLS-1$
stb.append(this.voc.valueToString(this.head)); stb.append(this.voc.valueToString(this.head));
......
...@@ -169,7 +169,7 @@ public abstract class WLClause implements Propagatable, Constr, Serializable { ...@@ -169,7 +169,7 @@ public abstract class WLClause implements Propagatable, Constr, Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int lit : this.lits) { for (int lit : this.lits) {
stb.append(Lits.toString(lit)); stb.append(Lits.toString(lit));
stb.append("["); //$NON-NLS-1$ stb.append("["); //$NON-NLS-1$
...@@ -184,7 +184,7 @@ public abstract class WLClause implements Propagatable, Constr, Serializable { ...@@ -184,7 +184,7 @@ public abstract class WLClause implements Propagatable, Constr, Serializable {
if (mapper == null) { if (mapper == null) {
return toString(); return toString();
} }
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int lit : this.lits) { for (int lit : this.lits) {
stb.append(mapper.map(LiteralsUtils.toDimacs(lit))); stb.append(mapper.map(LiteralsUtils.toDimacs(lit)));
stb.append("["); //$NON-NLS-1$ stb.append("["); //$NON-NLS-1$
......
...@@ -102,7 +102,7 @@ public final class IntQueue implements Serializable { ...@@ -102,7 +102,7 @@ public final class IntQueue implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
stb.append(">"); //$NON-NLS-1$ stb.append(">"); //$NON-NLS-1$
for (int i = this.first; i < this.size - 1; i++) { for (int i = this.first; i < this.size - 1; i++) {
stb.append(this.myarray[i]); stb.append(this.myarray[i]);
......
...@@ -109,7 +109,7 @@ public class SearchParams implements Serializable { ...@@ -109,7 +109,7 @@ public class SearchParams implements Serializable {
*/ */
@Override @Override
public String toString() { public String toString() {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (Field field : SearchParams.class.getDeclaredFields()) { for (Field field : SearchParams.class.getDeclaredFields()) {
if (!field.getName().startsWith("serial") if (!field.getName().startsWith("serial")
&& !field.getName().startsWith("class")) { && !field.getName().startsWith("class")) {
......
...@@ -2019,7 +2019,7 @@ public class Solver<D extends DataStructureFactory> ...@@ -2019,7 +2019,7 @@ public class Solver<D extends DataStructureFactory>
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
public String toString(String prefix) { public String toString(String prefix) {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
Object[] objs = { this.dsfactory, this.learner, this.params, this.order, Object[] objs = { this.dsfactory, this.learner, this.params, this.order,
this.simplifier, this.restarter, this.simplifier, this.restarter,
this.learnedConstraintsDeletionStrategy }; this.learnedConstraintsDeletionStrategy };
......
...@@ -63,7 +63,7 @@ public class AAGReader extends Reader { ...@@ -63,7 +63,7 @@ public class AAGReader extends Reader {
@Override @Override
public String decode(int[] model) { public String decode(int[] model) {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int i = 0; i < this.nbinputs; i++) { for (int i = 0; i < this.nbinputs; i++) {
stb.append(model[i] > 0 ? 1 : 0); stb.append(model[i] > 0 ? 1 : 0);
} }
......
...@@ -62,7 +62,7 @@ public class AIGReader extends Reader { ...@@ -62,7 +62,7 @@ public class AIGReader extends Reader {
@Override @Override
public String decode(int[] model) { public String decode(int[] model) {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int i = 0; i < this.nbinputs; i++) { for (int i = 0; i < this.nbinputs; i++) {
stb.append(model[i] > 0 ? 1 : 0); stb.append(model[i] > 0 ? 1 : 0);
} }
......
...@@ -263,7 +263,7 @@ public class DimacsReader extends Reader implements Serializable { ...@@ -263,7 +263,7 @@ public class DimacsReader extends Reader implements Serializable {
@Override @Override
public String decode(int[] model) { public String decode(int[] model) {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int element : model) { for (int element : model) {
stb.append(element); stb.append(element);
stb.append(" "); stb.append(" ");
......
...@@ -124,7 +124,7 @@ public class EfficientScanner implements Serializable { ...@@ -124,7 +124,7 @@ public class EfficientScanner implements Serializable {
} }
public BigInteger nextBigInteger() throws IOException, ParseFormatException { public BigInteger nextBigInteger() throws IOException, ParseFormatException {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
char currentChar = skipSpaces(); char currentChar = skipSpaces();
if (currentChar == '-') { if (currentChar == '-') {
stb.append(currentChar); stb.append(currentChar);
...@@ -149,7 +149,7 @@ public class EfficientScanner implements Serializable { ...@@ -149,7 +149,7 @@ public class EfficientScanner implements Serializable {
* never used in that method. * never used in that method.
*/ */
public String next() throws IOException, ParseFormatException { public String next() throws IOException, ParseFormatException {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
char currentChar = skipSpaces(); char currentChar = skipSpaces();
while (currentChar != ' ' && currentChar != '\n') { while (currentChar != ' ' && currentChar != '\n') {
stb.append(currentChar); stb.append(currentChar);
...@@ -169,7 +169,7 @@ public class EfficientScanner implements Serializable { ...@@ -169,7 +169,7 @@ public class EfficientScanner implements Serializable {
} }
public String nextLine() throws IOException { public String nextLine() throws IOException {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
char car; char car;
do { do {
car = (char) this.in.read(); car = (char) this.in.read();
......
...@@ -254,7 +254,7 @@ public class LecteurDimacs extends Reader implements Serializable { ...@@ -254,7 +254,7 @@ public class LecteurDimacs extends Reader implements Serializable {
private char manageCommentLine() throws IOException { private char manageCommentLine() throws IOException {
char car; char car;
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
do { do {
car = (char) this.in.read(); car = (char) this.in.read();
stb.append(car); stb.append(car);
...@@ -292,7 +292,7 @@ public class LecteurDimacs extends Reader implements Serializable { ...@@ -292,7 +292,7 @@ public class LecteurDimacs extends Reader implements Serializable {
@Override @Override
public String decode(int[] model) { public String decode(int[] model) {
StringBuffer stb = new StringBuffer(); StringBuilder stb = new StringBuilder();
for (int element : model) { for (int element : model) {
stb.append(element); stb.append(element);
stb.append(" "); stb.append(" ");
......
...@@ -92,7 +92,7 @@ public class DimacsArrayReader implements Serializable { ...@@ -92,7 +92,7 @@ public class DimacsArrayReader implements Serializable {
} }
public String decode(int[] model) { public String decode(int[] model) {
StringBuffer stb = new StringBuffer(4 * model.length); StringBuilder stb = new StringBuilder(4 * model.length);
for (int element : model) { for (int element : model) {
stb.append(element); stb.append(element);
stb.append(" "); stb.append(" ");
......
...@@ -57,7 +57,7 @@ public class DimacsStringSolver extends AbstractOutputSolver ...@@ -57,7 +57,7 @@ public class DimacsStringSolver extends AbstractOutputSolver
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private StringBuffer out; private StringBuilder out;
private int firstCharPos; private int firstCharPos;
...@@ -70,11 +70,11 @@ public class DimacsStringSolver extends AbstractOutputSolver ...@@ -70,11 +70,11 @@ public class DimacsStringSolver extends AbstractOutputSolver
} }
public DimacsStringSolver(int initSize) { public DimacsStringSolver(int initSize) {
this.out = new StringBuffer(initSize); this.out = new StringBuilder(initSize);
this.initBuilderSize = initSize; this.initBuilderSize = initSize;
} }
public StringBuffer getOut() { public StringBuilder getOut() {
return this.out; return this.out;
} }
...@@ -174,7 +174,7 @@ public class DimacsStringSolver extends AbstractOutputSolver ...@@ -174,7 +174,7 @@ public class DimacsStringSolver extends AbstractOutputSolver
public void reset() { public void reset() {
this.fixedNbClauses = false; this.fixedNbClauses = false;
this.firstConstr = true; this.firstConstr = true;
this.out = new StringBuffer(this.initBuilderSize); this.out = new StringBuilder(this.initBuilderSize);
this.maxvarid = 0; this.maxvarid = 0;
} }
......
...@@ -305,7 +305,7 @@ public class ManyCore<S extends ISolver> ...@@ -305,7 +305,7 @@ public class ManyCore<S extends ISolver>
} }
public String toString(String prefix) { public String toString(String prefix) {
StringBuffer res = new StringBuffer(); StringBuilder res = new StringBuilder();
res.append(prefix); res.append(prefix);
res.append("ManyCore solver with "); res.append("ManyCore solver with ");
res.append(this.numberOfSolvers); res.append(this.numberOfSolvers);
......
...@@ -93,7 +93,7 @@ public class ConnectionCtrBuilder { ...@@ -93,7 +93,7 @@ public class ConnectionCtrBuilder {
} }
private boolean buildCtrMinOrMax(XVarInteger[] list, Condition condition, boolean isMax) { private boolean buildCtrMinOrMax(XVarInteger[] list, Condition condition, boolean isMax) {
final StringBuffer leftOpBuf = new StringBuffer(); final StringBuilder leftOpBuf = new StringBuilder();
leftOpBuf.append(isMax ? "max(" : "min("); leftOpBuf.append(isMax ? "max(" : "min(");
String norm = CtrBuilderUtils.normalizeCspVarName(list[0].id); String norm = CtrBuilderUtils.normalizeCspVarName(list[0].id);
leftOpBuf.append(norm); leftOpBuf.append(norm);
...@@ -143,7 +143,7 @@ public class ConnectionCtrBuilder { ...@@ -143,7 +143,7 @@ public class ConnectionCtrBuilder {
private boolean buildCtrMinOrMaxAtIndex(XVarInteger[] list, XVarInteger index, int startIndex, boolean isMax) { private boolean buildCtrMinOrMaxAtIndex(XVarInteger[] list, XVarInteger index, int startIndex, boolean isMax) {
String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id); String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id);
StringBuffer maxExprBuf = new StringBuffer(); StringBuilder maxExprBuf = new StringBuilder();
maxExprBuf.append(isMax ? "max(" : "min("); maxExprBuf.append(isMax ? "max(" : "min(");
for(int i=0; i<list.length; ++i) { for(int i=0; i<list.length; ++i) {
String normVar = CtrBuilderUtils.normalizeCspVarName(list[i].id); String normVar = CtrBuilderUtils.normalizeCspVarName(list[i].id);
...@@ -165,7 +165,7 @@ public class ConnectionCtrBuilder { ...@@ -165,7 +165,7 @@ public class ConnectionCtrBuilder {
// index==i => and(x0<xi,...,x(i-1)<xi) // index==i => and(x0<xi,...,x(i-1)<xi)
String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id); String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id);
String normMax = CtrBuilderUtils.normalizeCspVarName(list[i-startIndex].id); String normMax = CtrBuilderUtils.normalizeCspVarName(list[i-startIndex].id);
StringBuffer andExprBuf = new StringBuffer(); StringBuilder andExprBuf = new StringBuilder();
andExprBuf.append("and("); andExprBuf.append("and(");
for(int j=0; j<i-startIndex; ++j) { for(int j=0; j<i-startIndex; ++j) {
String normCurVar = CtrBuilderUtils.normalizeCspVarName(list[j].id); String normCurVar = CtrBuilderUtils.normalizeCspVarName(list[j].id);
...@@ -184,7 +184,7 @@ public class ConnectionCtrBuilder { ...@@ -184,7 +184,7 @@ public class ConnectionCtrBuilder {
// index==i => and(x(i+1)<xi,...,xn<xi) // index==i => and(x(i+1)<xi,...,xn<xi)
String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id); String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id);
String normMax = CtrBuilderUtils.normalizeCspVarName(list[i-startIndex].id); String normMax = CtrBuilderUtils.normalizeCspVarName(list[i-startIndex].id);
StringBuffer andExprBuf = new StringBuffer(); StringBuilder andExprBuf = new StringBuilder();
andExprBuf.append("and("); andExprBuf.append("and(");
for(int j=i-startIndex+1; j<list.length; ++j) { for(int j=i-startIndex+1; j<list.length; ++j) {
String normCurVar = CtrBuilderUtils.normalizeCspVarName(list[j].id); String normCurVar = CtrBuilderUtils.normalizeCspVarName(list[j].id);
...@@ -271,7 +271,7 @@ public class ConnectionCtrBuilder { ...@@ -271,7 +271,7 @@ public class ConnectionCtrBuilder {
// or(ne(i,index),and(eq(i,index),eq(xi,value),ne(x0,value),...,ne(xi-1,value))) // or(ne(i,index),and(eq(i,index),eq(xi,value),ne(x0,value),...,ne(xi-1,value)))
String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id); String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id);
String normValue = CtrBuilderUtils.normalizeCspVarName(value.id); String normValue = CtrBuilderUtils.normalizeCspVarName(value.id);
StringBuffer sbuf = new StringBuffer(); StringBuilder sbuf = new StringBuilder();
sbuf.append("or(ne(").append(i+startIndex).append(',').append(normIndex).append("),and(eq(").append(i+startIndex).append(',').append(normIndex).append("),eq(").append(CtrBuilderUtils.normalizeCspVarName(list[i].id)).append(',').append(normValue).append(')'); sbuf.append("or(ne(").append(i+startIndex).append(',').append(normIndex).append("),and(eq(").append(i+startIndex).append(',').append(normIndex).append("),eq(").append(CtrBuilderUtils.normalizeCspVarName(list[i].id)).append(',').append(normValue).append(')');
for(int j=0; j<i; ++j) { for(int j=0; j<i; ++j) {
sbuf.append(",ne(").append(CtrBuilderUtils.normalizeCspVarName(list[j].id)).append(',').append(normValue).append(')'); // end NE operator sbuf.append(",ne(").append(CtrBuilderUtils.normalizeCspVarName(list[j].id)).append(',').append(normValue).append(')'); // end NE operator
...@@ -287,7 +287,7 @@ public class ConnectionCtrBuilder { ...@@ -287,7 +287,7 @@ public class ConnectionCtrBuilder {
// or(ne(i,index),and(eq(i,index),eq(xi,value),ne(xi+1,value),...,ne(xn,value))) // or(ne(i,index),and(eq(i,index),eq(xi,value),ne(xi+1,value),...,ne(xn,value)))
String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id); String normIndex = CtrBuilderUtils.normalizeCspVarName(index.id);
String normValue = CtrBuilderUtils.normalizeCspVarName(value.id); String normValue = CtrBuilderUtils.normalizeCspVarName(value.id);
StringBuffer sbuf = new StringBuffer(); StringBuilder sbuf = new StringBuilder();
sbuf.append("or(ne(").append(i+startIndex).append(',').append(normIndex).append("),and(eq(").append(i+startIndex).append(',').append(normIndex).append("),eq(").append(CtrBuilderUtils.normalizeCspVarName(list[i].id)).append(',').append(normValue).append(')'); // end EQ2 operator sbuf.append("or(ne(").append(i+startIndex).append(',').append(normIndex).append("),and(eq(").append(i+startIndex).append(',').append(normIndex).append("),eq(").append(CtrBuilderUtils.normalizeCspVarName(list[i].id)).append(',').append(normValue).append(')'); // end EQ2 operator
for(int j=i+1; j<list.length; ++j) { for(int j=i+1; j<list.length; ++j) {
sbuf.append(",ne(").append(CtrBuilderUtils.normalizeCspVarName(list[j].id)).append(',').append(normValue).append(')'); sbuf.append(",ne(").append(CtrBuilderUtils.normalizeCspVarName(list[j].id)).append(',').append(normValue).append(')');
......
...@@ -52,7 +52,7 @@ public class CountingCtrBuilder { ...@@ -52,7 +52,7 @@ public class CountingCtrBuilder {
public boolean buildCtrSum(String id, XVarInteger[] list, int[] coeffs, Condition condition) { public boolean buildCtrSum(String id, XVarInteger[] list, int[] coeffs, Condition condition) {
String varId; String varId;
StringBuffer exprBuf = new StringBuffer(); StringBuilder exprBuf = new StringBuilder();