Overrides toString and equals methods of the relative block vector to make it testable

This commit is contained in:
Kristian Knarvik 2021-02-22 15:49:44 +01:00
parent a475e8d8b1
commit c422cb9ea9

View File

@ -54,4 +54,19 @@ public class RelativeBlockVector {
return distance; return distance;
} }
@Override
public String toString() {
return String.format("right = %d, depth = %d, distance = %d", right, depth, distance);
}
@Override
public boolean equals(Object other) {
if (!(other instanceof RelativeBlockVector)) {
return false;
}
RelativeBlockVector otherVector = (RelativeBlockVector) other;
return this.right == otherVector.right && this.depth == otherVector.depth &&
this.distance == otherVector.distance;
}
} }