summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/esodata/SingleTape.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2018-02-12 22:45:04 -0500
committerbjculkin <bjculkin@mix.wvu.edu>2018-02-12 22:45:04 -0500
commitdf94066e3af02ff02d5ab4d033a3d603f743234c (patch)
tree168a1edaf58d386c175ffb601e9d4da8e13d31e2 /base/src/main/java/bjc/utils/esodata/SingleTape.java
parentae51c587c53f7ca311e556e3cbd0c5566d6c2843 (diff)
Formatting pass
Diffstat (limited to 'base/src/main/java/bjc/utils/esodata/SingleTape.java')
-rw-r--r--base/src/main/java/bjc/utils/esodata/SingleTape.java43
1 files changed, 22 insertions, 21 deletions
diff --git a/base/src/main/java/bjc/utils/esodata/SingleTape.java b/base/src/main/java/bjc/utils/esodata/SingleTape.java
index ae9b746..57ee99a 100644
--- a/base/src/main/java/bjc/utils/esodata/SingleTape.java
+++ b/base/src/main/java/bjc/utils/esodata/SingleTape.java
@@ -15,20 +15,20 @@ import java.util.ArrayList;
* policy.
*
* @param <T>
- * The element type of the tape.
+ * The element type of the tape.
*
* @author bjculkin
*/
public class SingleTape<T> implements Tape<T> {
- /* @NOTE
- * Does this stuff still need to be protected? We're not trying to
- * use inheritance to implement tape types any more, so I don't see
- * any reason to not have it be private.
+ /*
+ * @NOTE Does this stuff still need to be protected? We're not trying to
+ * use inheritance to implement tape types any more, so I don't see any
+ * reason to not have it be private.
*/
/* Our backing store. */
- protected ArrayList<T> backing;
+ protected ArrayList<T> backing;
/* Our position in the list. */
- protected int pos;
+ protected int pos;
/* Whether to auto-extend the list on the left with nulls. */
protected boolean autoExtend;
@@ -57,7 +57,7 @@ public class SingleTape<T> implements Tape<T> {
* 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 SingleTape(final boolean autoExtnd) {
autoExtend = autoExtnd;
@@ -92,7 +92,7 @@ public class SingleTape<T> implements Tape<T> {
@Override
public void insertAfter(final T itm) {
- if (pos == backing.size() - 1) {
+ if(pos == backing.size() - 1) {
backing.add(itm);
} else {
backing.add(pos + 1, itm);
@@ -102,7 +102,7 @@ public class SingleTape<T> implements Tape<T> {
@Override
public T remove() {
final T res = backing.remove(pos);
- if (pos != 0) {
+ if(pos != 0) {
pos -= 1;
}
return res;
@@ -125,7 +125,7 @@ public class SingleTape<T> implements Tape<T> {
@Override
public boolean left(final int amt) {
- if (pos - amt < 0) return false;
+ if(pos - amt < 0) return false;
pos -= amt;
return true;
@@ -138,12 +138,13 @@ public class SingleTape<T> implements Tape<T> {
@Override
public boolean right(final int amt) {
- if (pos + amt >= backing.size() - 1) {
- if (autoExtend) {
- while (pos + amt >= backing.size() - 1) {
+ if(pos + amt >= backing.size() - 1) {
+ if(autoExtend) {
+ while(pos + amt >= backing.size() - 1) {
backing.add(null);
}
- } else return false;
+ } else
+ return false;
}
pos += amt;
@@ -167,15 +168,15 @@ public class SingleTape<T> implements Tape<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof SingleTape<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof SingleTape<?>)) return false;
final SingleTape<?> other = (SingleTape<?>) obj;
- if (backing == null) {
- if (other.backing != null) return false;
- } else if (!backing.equals(other.backing)) return false;
+ if(backing == null) {
+ if(other.backing != null) return false;
+ } else if(!backing.equals(other.backing)) return false;
return true;
}