summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/esodata/TapeChanger.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/TapeChanger.java
parentae51c587c53f7ca311e556e3cbd0c5566d6c2843 (diff)
Formatting pass
Diffstat (limited to 'base/src/main/java/bjc/utils/esodata/TapeChanger.java')
-rw-r--r--base/src/main/java/bjc/utils/esodata/TapeChanger.java79
1 files changed, 37 insertions, 42 deletions
diff --git a/base/src/main/java/bjc/utils/esodata/TapeChanger.java b/base/src/main/java/bjc/utils/esodata/TapeChanger.java
index 08f56c1..2623ad3 100644
--- a/base/src/main/java/bjc/utils/esodata/TapeChanger.java
+++ b/base/src/main/java/bjc/utils/esodata/TapeChanger.java
@@ -10,13 +10,13 @@ package bjc.utils.esodata;
* either return null/false.
*
* @param <T>
- * The element type of the tapes.
+ * The element type of the tapes.
*/
public class TapeChanger<T> implements Tape<T> {
/* Our list of tapes. */
private Tape<Tape<T>> tapes;
/* The current tape. */
- private Tape<T> currentTape;
+ private Tape<T> currentTape;
/** Create a new empty tape changer. */
public TapeChanger() {
@@ -27,10 +27,10 @@ public class TapeChanger<T> implements Tape<T> {
* Create a new tape changer with the specified tapes.
*
* @param current
- * The tape to mount first.
+ * The tape to mount first.
*
* @param others
- * The tapes to put in this tape changer.
+ * The tapes to put in this tape changer.
*/
@SafeVarargs
public TapeChanger(final Tape<T> current, final Tape<T>... others) {
@@ -38,7 +38,7 @@ public class TapeChanger<T> implements Tape<T> {
tapes.insertBefore(current);
- for (final Tape<T> tp : others) {
+ for(final Tape<T> tp : others) {
tapes.insertAfter(tp);
tapes.right();
}
@@ -49,63 +49,63 @@ public class TapeChanger<T> implements Tape<T> {
@Override
public T item() {
- if (currentTape == null) return null;
+ if(currentTape == null) return null;
return currentTape.item();
}
@Override
public void item(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.item(itm);
}
@Override
public int size() {
- if (currentTape == null) return 0;
+ if(currentTape == null) return 0;
return currentTape.size();
}
@Override
public int position() {
- if (currentTape == null) return 0;
+ if(currentTape == null) return 0;
return currentTape.position();
}
@Override
public void insertBefore(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.insertBefore(itm);
}
@Override
public void insertAfter(final T itm) {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.insertAfter(itm);
}
@Override
public T remove() {
- if (currentTape == null) return null;
+ if(currentTape == null) return null;
return currentTape.remove();
}
@Override
public void first() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.first();
}
@Override
public void last() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
currentTape.last();
}
@@ -117,7 +117,7 @@ public class TapeChanger<T> implements Tape<T> {
@Override
public boolean left(final int amt) {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.left(amt);
}
@@ -129,7 +129,7 @@ public class TapeChanger<T> implements Tape<T> {
@Override
public boolean right(final int amt) {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.right(amt);
}
@@ -143,16 +143,16 @@ public class TapeChanger<T> implements Tape<T> {
* If the current tape is not double-sided, does nothing.
*/
public void flip() {
- if (currentTape == null) return;
+ if(currentTape == null) return;
- if (currentTape.isDoubleSided()) {
+ if(currentTape.isDoubleSided()) {
((DoubleTape<T>) currentTape).flip();
}
}
@Override
public boolean isDoubleSided() {
- if (currentTape == null) return false;
+ if(currentTape == null) return false;
return currentTape.isDoubleSided();
}
@@ -160,8 +160,7 @@ public class TapeChanger<T> implements Tape<T> {
/**
* Check if a tape is currently loaded.
*
- * @return
- * Whether or not a tape is loaded.
+ * @return Whether or not a tape is loaded.
*/
public boolean isLoaded() {
return currentTape != null;
@@ -173,13 +172,12 @@ public class TapeChanger<T> implements Tape<T> {
* Attempting to load a tape that isn't there won't eject the current
* tape.
*
- * @return
- * Whether or not the next tape was loaded.
+ * @return Whether or not the next tape was loaded.
*/
public boolean nextTape() {
final boolean succ = tapes.right();
- if (succ) {
+ if(succ) {
currentTape = tapes.item();
}
@@ -192,13 +190,12 @@ public class TapeChanger<T> implements Tape<T> {
* Attempting to load a tape that isn't there won't eject the current
* tape.
*
- * @return
- * Whether or not the previous tape was loaded.
+ * @return Whether or not the previous tape was loaded.
*/
public boolean prevTape() {
final boolean succ = tapes.left();
- if (succ) {
+ if(succ) {
currentTape = tapes.item();
}
@@ -213,7 +210,7 @@ public class TapeChanger<T> implements Tape<T> {
* The specified tape is loaded.
*
* @param tp
- * The tape to insert and load.
+ * The tape to insert and load.
*/
public void insertTape(final Tape<T> tp) {
tapes.insertAfter(tp);
@@ -229,11 +226,10 @@ public class TapeChanger<T> implements Tape<T> {
*
* Loads the previous tape, if there is one.
*
- * @return
- * The removed tape.
+ * @return The removed tape.
*/
public Tape<T> removeTape() {
- if (currentTape == null) return null;
+ if(currentTape == null) return null;
final Tape<T> tp = tapes.remove();
currentTape = tapes.item();
@@ -253,8 +249,7 @@ public class TapeChanger<T> implements Tape<T> {
/**
* Get how many tapes are currently in the changer.
*
- * @return
- * How many tapes are currently in the changer.
+ * @return How many tapes are currently in the changer.
*/
public int tapeCount() {
return tapes.size();
@@ -271,19 +266,19 @@ public class TapeChanger<T> implements Tape<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof TapeChanger<?>)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof TapeChanger<?>)) return false;
final TapeChanger<?> other = (TapeChanger<?>) obj;
- if (currentTape == null) {
- if (other.currentTape != null) return false;
- } else if (!currentTape.equals(other.currentTape)) return false;
+ if(currentTape == null) {
+ if(other.currentTape != null) return false;
+ } else if(!currentTape.equals(other.currentTape)) return false;
- if (tapes == null) {
- if (other.tapes != null) return false;
- } else if (!tapes.equals(other.tapes)) return false;
+ if(tapes == null) {
+ if(other.tapes != null) return false;
+ } else if(!tapes.equals(other.tapes)) return false;
return true;
}