summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/esodata/TapeLibrary.java
diff options
context:
space:
mode:
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/esodata/TapeLibrary.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/esodata/TapeLibrary.java60
1 files changed, 30 insertions, 30 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/esodata/TapeLibrary.java b/BJC-Utils2/src/main/java/bjc/utils/esodata/TapeLibrary.java
index 3a49175..732f579 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/esodata/TapeLibrary.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/esodata/TapeLibrary.java
@@ -8,7 +8,7 @@ import java.util.Map;
*
* It has a current tape that you can do operations to, but also operations to
* add/remove other tapes.
- *
+ *
* If there is no tape currently loaded into the changer, all the methods will
* either return null/false.
*
@@ -16,8 +16,8 @@ import java.util.Map;
* The element type of the tapes.
*/
public class TapeLibrary<T> implements Tape<T> {
- private Map<String, Tape<T>> tapes;
- private Tape<T> currentTape;
+ private Map<String, Tape<T>> tapes;
+ private Tape<T> currentTape;
/**
* Create a new empty tape library.
@@ -31,9 +31,9 @@ public class TapeLibrary<T> implements Tape<T> {
*
* @return The item the tape is on.
*/
+ @Override
public T item() {
- if (currentTape == null)
- return null;
+ if(currentTape == null) return null;
return currentTape.item();
}
@@ -44,9 +44,9 @@ public class TapeLibrary<T> implements Tape<T> {
* @param itm
* The new value for the tape item.
*/
+ @Override
public void item(T itm) {
- if (currentTape == null)
- return;
+ if(currentTape == null) return;
currentTape.item(itm);
}
@@ -56,9 +56,9 @@ public class TapeLibrary<T> implements Tape<T> {
*
* @return The current number of elements in the tape.
*/
+ @Override
public int size() {
- if (currentTape == null)
- return 0;
+ if(currentTape == null) return 0;
return currentTape.size();
}
@@ -69,9 +69,9 @@ public class TapeLibrary<T> implements Tape<T> {
* @param itm
* The item to add.
*/
+ @Override
public void insertBefore(T itm) {
- if (currentTape == null)
- return;
+ if(currentTape == null) return;
currentTape.insertBefore(itm);
}
@@ -79,24 +79,24 @@ public class TapeLibrary<T> implements Tape<T> {
/**
* Insert an element after the current item.
*/
+ @Override
public void insertAfter(T itm) {
- if (currentTape == null)
- return;
+ if(currentTape == null) return;
currentTape.insertAfter(itm);
}
/**
* 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
*
* @return The removed item from the active side.
*/
+ @Override
public T remove() {
- if (currentTape == null)
- return null;
+ if(currentTape == null) return null;
return currentTape.remove();
}
@@ -104,9 +104,9 @@ public class TapeLibrary<T> implements Tape<T> {
/**
* Move the cursor to the left-most position.
*/
+ @Override
public void first() {
- if (currentTape == null)
- return;
+ if(currentTape == null) return;
currentTape.first();
}
@@ -114,9 +114,9 @@ public class TapeLibrary<T> implements Tape<T> {
/**
* Move the cursor the right-most position.
*/
+ @Override
public void last() {
- if (currentTape == null)
- return;
+ if(currentTape == null) return;
currentTape.last();
}
@@ -128,6 +128,7 @@ public class TapeLibrary<T> implements Tape<T> {
*
* @return True if the cursor was moved left.
*/
+ @Override
public boolean left() {
return left(1);
}
@@ -143,9 +144,9 @@ public class TapeLibrary<T> implements Tape<T> {
*
* @return True if the cursor was moved left.
*/
+ @Override
public boolean left(int amt) {
- if (currentTape == null)
- return false;
+ if(currentTape == null) return false;
return currentTape.left(amt);
}
@@ -157,6 +158,7 @@ public class TapeLibrary<T> implements Tape<T> {
*
* @return Whether the cursor was moved right.
*/
+ @Override
public boolean right() {
return right(1);
}
@@ -171,9 +173,9 @@ public class TapeLibrary<T> implements Tape<T> {
*
* @return Whether the cursor was moved right.
*/
+ @Override
public boolean right(int amt) {
- if (currentTape == null)
- return false;
+ if(currentTape == null) return false;
return currentTape.right(amt);
}
@@ -187,18 +189,16 @@ public class TapeLibrary<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();
}
@@ -224,7 +224,7 @@ public class TapeLibrary<T> implements Tape<T> {
* @return Whether or not the next tape was loaded.
*/
public boolean switchTape(String label) {
- if (tapes.containsKey(label)) {
+ if(tapes.containsKey(label)) {
currentTape = tapes.get(label);
return true;
}