From 27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd Mon Sep 17 00:00:00 2001 From: EVE Date: Mon, 13 Mar 2017 16:42:21 -0400 Subject: Formatting --- .../main/java/bjc/utils/esodata/DoubleTape.java | 63 +++++++++++++--------- 1 file changed, 37 insertions(+), 26 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 bc8ac51..85abbdc 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java +++ b/BJC-Utils2/src/main/java/bjc/utils/esodata/DoubleTape.java @@ -1,22 +1,26 @@ package bjc.utils.esodata; /** - * Double-sided tape is essentially two tapes stuck together with a shared cursor. + * Double-sided tape is essentially two tapes stuck together with a shared + * cursor. * - * The main way a double-sided tape differs is that it can be flipped, allowing access to - * another set of data. + * The main way a double-sided tape differs is that it can be flipped, allowing + * access to another set of data. * - * However, there is only one cursor, and the position of the cursor on one side is the inverse - * of the position on the other side. + * However, there is only one cursor, and the position of the cursor on one side + * is the inverse of the position on the other side. * - * When one side is extended, a null will be inserted into the inactive side regardless of the - * auto-extension policy of the tape. The policy will still be respected for the active side. + * When one side is extended, a null will be inserted into the inactive side + * regardless of the auto-extension policy of the tape. The policy will still be + * respected for the active side. * - * All operations that refer to the tape refer to the currently active side of the tape, except for flip. + * All operations that refer to the tape refer to the currently active side of + * the tape, except for flip. * * Flip refers to the entire tape for 'obvious' reasons. * - * @param T The element type of the tape. + * @param T + * The element type of the tape. * @author bjculkin */ public class DoubleTape implements Tape { @@ -31,14 +35,16 @@ public class DoubleTape implements Tape { } /** - * Create a new empty double-sided tape that follows the specified auto-extension policy. + * Create a new empty double-sided tape that follows the specified + * auto-extension policy. * - * @param autoExtnd Whether or not to auto-extend the tape to the right - * w/ nulls. + * @param autoExtnd + * Whether or not to auto-extend the tape to the right w/ + * nulls. */ public DoubleTape(boolean autoExtnd) { front = new SingleTape<>(autoExtnd); - back = new SingleTape<>(autoExtnd); + back = new SingleTape<>(autoExtnd); } /** @@ -53,7 +59,8 @@ public class DoubleTape implements Tape { /** * Set the item the tape is currently on. * - * @param itm The new value for the tape item. + * @param itm + * The new value for the tape item. */ public void item(T itm) { front.item(itm); @@ -71,7 +78,8 @@ public class DoubleTape implements Tape { /** * Insert an element before the current item. * - * @param itm The item to add. + * @param itm + * The item to add. */ public void insertBefore(T itm) { front.insertBefore(itm); @@ -89,8 +97,8 @@ public class DoubleTape implements Tape { /** * Remove the current element. * - * Also moves the cursor back one step if possible to maintain - * relative position, and removes the corresponding item from the non-active side + * Also moves the cursor back one step if possible to maintain relative + * position, and removes the corresponding item from the non-active side * * @return The removed item from the active side. */ @@ -130,23 +138,23 @@ public class DoubleTape implements Tape { /** * Move the cursor the specified amount left. * - * The cursor can't go past zero. - * Attempts to move the cursor by amounts that would exceed zero - * don't move the cursor at all. + * The cursor can't go past zero. Attempts to move the cursor by amounts + * that would exceed zero don't move the cursor at all. * - * @param amt The amount to attempt to move the cursor left. + * @param amt + * The amount to attempt to move the cursor left. * * @return True if the cursor was moved left. */ public boolean left(int amt) { boolean succ = front.left(amt); - if(succ) back.right(amt); + if (succ) + back.right(amt); return succ; } - /** * Move the cursor one space right. * @@ -163,14 +171,16 @@ public class DoubleTape implements Tape { * * Moving the cursor right will auto-extend the tape if that is enabled. * - * @param amt The amount to move the cursor right by. + * @param amt + * The amount to move the cursor right by. * * @return Whether the cursor was moved right. */ public boolean right(int amt) { boolean succ = front.right(amt); - if(succ) back.left(amt); + if (succ) + back.left(amt); return succ; } @@ -178,7 +188,8 @@ public class DoubleTape implements Tape { /** * Flips the tape. * - * The active side becomes inactive, and the inactive side becomes active. + * The active side becomes inactive, and the inactive side becomes + * active. */ public void flip() { Tape tmp = front; -- cgit v1.2.3