From f51f6da7319787348c38b875652b5c0e9f88c8aa Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:43:13 -0400 Subject: Cleanup pass Pass to do some cleanups --- src/main/java/bjc/esodata/DoubleTape.java | 37 +++++++++++++++++++------------ 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'src/main/java/bjc/esodata/DoubleTape.java') 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 - * The element type of the tape. + * The element type of the tape. * * @author bjculkin */ @@ -42,7 +42,8 @@ public class DoubleTape implements Tape, 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 implements Tape, 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 implements Tape, 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 implements Tape, 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; } -- cgit v1.2.3