summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/esodata/DoubleTape.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-04-13 18:43:13 -0400
committerBen Culkin <scorpress@gmail.com>2020-04-13 18:43:13 -0400
commitf51f6da7319787348c38b875652b5c0e9f88c8aa (patch)
tree943888fc724da2d2dedd89abec99dcbfcc089fd0 /src/main/java/bjc/esodata/DoubleTape.java
parent9052ed6da37af23ea82588d248f409e60a33c6cb (diff)
Cleanup pass
Pass to do some cleanups
Diffstat (limited to 'src/main/java/bjc/esodata/DoubleTape.java')
-rw-r--r--src/main/java/bjc/esodata/DoubleTape.java37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/main/java/bjc/esodata/DoubleTape.java b/src/main/java/bjc/esodata/DoubleTape.java
index c36fcff..cc7cdb9 100644
--- a/src/main/java/bjc/esodata/DoubleTape.java
+++ b/src/main/java/bjc/esodata/DoubleTape.java
@@ -20,7 +20,7 @@ package bjc.esodata;
* Flip refers to the entire tape for 'obvious' reasons.
*
* @param <T>
- * The element type of the tape.
+ * The element type of the tape.
*
* @author bjculkin
*/
@@ -42,7 +42,8 @@ public class DoubleTape<T> implements Tape<T>, DoubleSided {
* auto-extension policy.
*
* @param autoExtnd
- * Whether or not to auto-extend the tape to the right w/ nulls.
+ * Whether or not to auto-extend the tape to the right w/
+ * nulls.
*/
public DoubleTape(final boolean autoExtnd) {
front = new SingleTape<>(autoExtnd);
@@ -111,7 +112,7 @@ public class DoubleTape<T> implements Tape<T>, DoubleSided {
public boolean left(final int amt) {
final boolean succ = front.left(amt);
- if(succ) {
+ if (succ) {
back.right(amt);
}
@@ -127,13 +128,14 @@ public class DoubleTape<T> implements Tape<T>, DoubleSided {
public boolean right(final int amt) {
final boolean succ = front.right(amt);
- if(succ) {
+ if (succ) {
back.left(amt);
}
return succ;
}
+ @Override
public boolean seekTo(int tgtPos) {
return front.seekTo(tgtPos);
}
@@ -165,19 +167,26 @@ public class DoubleTape<T> implements Tape<T>, DoubleSided {
@Override
public boolean equals(final Object obj) {
- if(this == obj) return true;
- if(obj == null) return false;
- if(!(obj instanceof DoubleTape<?>)) return false;
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof DoubleTape<?>))
+ return false;
final 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;
+ 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;
}