From c422cb9ea966d66f17d31dd89c7f4cd7e8c52b6a Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Mon, 22 Feb 2021 15:49:44 +0100 Subject: [PATCH] Overrides toString and equals methods of the relative block vector to make it testable --- .../knarcraft/stargate/RelativeBlockVector.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/net/knarcraft/stargate/RelativeBlockVector.java b/src/main/java/net/knarcraft/stargate/RelativeBlockVector.java index 3160361..eab9f91 100644 --- a/src/main/java/net/knarcraft/stargate/RelativeBlockVector.java +++ b/src/main/java/net/knarcraft/stargate/RelativeBlockVector.java @@ -54,4 +54,19 @@ public class RelativeBlockVector { 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; + } + }