diff options
Diffstat (limited to 'src/main/java/bjc/esodata/DoubleTape.java')
| -rw-r--r-- | src/main/java/bjc/esodata/DoubleTape.java | 37 |
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; } |
