From 889fac2bdf993dc86f64a8893c0260fdcf848acb Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 10 Apr 2017 16:40:33 -0400 Subject: Cleanup --- .../main/java/bjc/utils/esodata/DoubleTape.java | 47 +++++++++------------- 1 file changed, 20 insertions(+), 27 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java') 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 8df7aa9..0faaabf 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java +++ b/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java @@ -42,7 +42,7 @@ public class DoubleTape implements Tape { * Whether or not to auto-extend the tape to the right w/ * nulls. */ - public DoubleTape(boolean autoExtnd) { + public DoubleTape(final boolean autoExtnd) { front = new SingleTape<>(autoExtnd); back = new SingleTape<>(autoExtnd); } @@ -64,7 +64,7 @@ public class DoubleTape implements Tape { * The new value for the tape item. */ @Override - public void item(T itm) { + public void item(final T itm) { front.item(itm); } @@ -85,7 +85,7 @@ public class DoubleTape implements Tape { * The item to add. */ @Override - public void insertBefore(T itm) { + public void insertBefore(final T itm) { front.insertBefore(itm); back.insertAfter(null); } @@ -94,7 +94,7 @@ public class DoubleTape implements Tape { * Insert an element after the current item. */ @Override - public void insertAfter(T itm) { + public void insertAfter(final T itm) { front.insertAfter(itm); back.insertBefore(itm); } @@ -156,8 +156,8 @@ public class DoubleTape implements Tape { * @return True if the cursor was moved left. */ @Override - public boolean left(int amt) { - boolean succ = front.left(amt); + public boolean left(final int amt) { + final boolean succ = front.left(amt); if (succ) { back.right(amt); @@ -189,8 +189,8 @@ public class DoubleTape implements Tape { * @return Whether the cursor was moved right. */ @Override - public boolean right(int amt) { - boolean succ = front.right(amt); + public boolean right(final int amt) { + final boolean succ = front.right(amt); if (succ) { back.left(amt); @@ -206,7 +206,7 @@ public class DoubleTape implements Tape { * active. */ public void flip() { - Tape tmp = front; + final Tape tmp = front; front = back; @@ -222,33 +222,26 @@ public class DoubleTape implements Tape { 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()); + 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 (!(obj instanceof DoubleTape)) - return false; + public boolean equals(final Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (!(obj instanceof DoubleTape)) return false; - DoubleTape other = (DoubleTape) obj; + final DoubleTape other = (DoubleTape) obj; if (back == null) { - if (other.back != null) - return false; - } else if (!back.equals(other.back)) - return false; + 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 (other.front != null) return false; + } else if (!front.equals(other.front)) return false; return true; } -- cgit v1.2.3