Commit 6080bd19 authored by leberre's avatar leberre
Browse files

Fixed equals methods to make readonly vectors equal to their classical...

Fixed equals methods to make readonly vectors equal to their classical counterpart if they contain the same values in the same order.

git-svn-id: svn+ssh://svn.forge.ow2.org/svnroot/sat4j/maven/trunk@1670 ba638df5-4473-46d1-82f8-c3ae2a17a6e1
parent 7f4556de
......@@ -178,4 +178,14 @@ public final class ReadOnlyVec<T> implements IVec<T> {
return this.vec.toString();
}
@Override
public int hashCode() {
return this.vec.hashCode();
}
@Override
public boolean equals(Object obj) {
return this.vec.equals(obj);
}
}
......@@ -199,4 +199,14 @@ public final class ReadOnlyVecInt implements IVecInt {
return null;
}
@Override
public int hashCode() {
return this.vec.hashCode();
}
@Override
public boolean equals(Object obj) {
return this.vec.equals(obj);
}
}
......@@ -599,13 +599,13 @@ public final class VecInt implements IVecInt {
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof VecInt) {
VecInt v = (VecInt) obj;
if (v.nbelem != this.nbelem) {
if (obj instanceof IVecInt) {
IVecInt v = (IVecInt) obj;
if (v.size() != this.nbelem) {
return false;
}
for (int i = 0; i < this.nbelem; i++) {
if (v.myarray[i] != this.myarray[i]) {
if (v.get(i) != this.myarray[i]) {
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