Commit b4a917b8 authored by leberre's avatar leberre
Browse files

Implemented equals/hashcode methods to allow writing mock tests.

git-svn-id: svn+ssh://svn.forge.ow2.org/svnroot/sat4j/maven/trunk@1671 ba638df5-4473-46d1-82f8-c3ae2a17a6e1
parent 6080bd19
......@@ -177,4 +177,24 @@ public class ObjectiveFunction implements Serializable {
return false;
}
@Override
public int hashCode() {
return this.coeffs.hashCode() / 3 + this.vars.hashCode() / 3
+ this.correction.hashCode() / 3;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ObjectiveFunction) {
System.out.println(this + "/" + obj);
ObjectiveFunction of = (ObjectiveFunction) obj;
System.out.println(of.correction.equals(this.correction));
System.out.println(of.coeffs.equals(this.coeffs));
System.out.println(of.vars.equals(this.vars));
return of.correction.equals(this.correction)
&& of.coeffs.equals(this.coeffs)
&& of.vars.equals(this.vars);
}
return false;
}
}
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