summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2017-03-17 19:46:55 -0400
committerbjculkin <bjculkin@mix.wvu.edu>2017-03-17 19:46:55 -0400
commit338b2b16b6934d27dc4cd536fb5527b71985de4f (patch)
tree6dc7e85370507d22150cd7cef353a033b50a71d7 /BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java
parent5832ef0286430d04484b70d49c73e081a80ec9c7 (diff)
Add more toString/hashCode/equals
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java43
1 files changed, 42 insertions, 1 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java b/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java
index 6e256b6..ec24431 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java
@@ -19,7 +19,7 @@ package bjc.utils.esodata;
*
* Flip refers to the entire tape for 'obvious' reasons.
*
- * @param T
+ * @param <T>
* The element type of the tape.
* @author bjculkin
*/
@@ -217,4 +217,45 @@ public class DoubleTape<T> implements Tape<T> {
public boolean isDoubleSided() {
return true;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((back == null) ? 0 : back.hashCode());
+ result = prime * result + ((front == null) ? 0 : front.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(getClass() != obj.getClass()) return false;
+
+ DoubleTape<?> other = (DoubleTape<?>) obj;
+
+ if(back == null) {
+ if(other.back != null) return false;
+ } else if(!back.equals(other.back)) return false;
+
+ if(front == null) {
+ if(other.front != null) return false;
+ } else if(!front.equals(other.front)) return false;
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append("DoubleTape [front=");
+ builder.append(front);
+ builder.append(", back=");
+ builder.append(back);
+ builder.append("]");
+
+ return builder.toString();
+ }
}