diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-10-13 15:51:53 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2018-10-13 15:51:53 -0400 |
| commit | 327c2a35bde7a13d77f343464e41e19e4a214790 (patch) | |
| tree | 8ae7a2698eed1e281c20b9333b79b2eaf6607a92 /base/src/main/java/bjc/utils/esodata/Tape.java | |
| parent | bf9737ae3c61c638dca3a40ca847e784ddd750f3 (diff) | |
General cleanup and documentation.
Cleanup files, and add missing comments in places.
Diffstat (limited to 'base/src/main/java/bjc/utils/esodata/Tape.java')
| -rw-r--r-- | base/src/main/java/bjc/utils/esodata/Tape.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/base/src/main/java/bjc/utils/esodata/Tape.java b/base/src/main/java/bjc/utils/esodata/Tape.java index 41b0ce7..0835f7e 100644 --- a/base/src/main/java/bjc/utils/esodata/Tape.java +++ b/base/src/main/java/bjc/utils/esodata/Tape.java @@ -8,7 +8,7 @@ package bjc.utils.esodata; * unbounded to the right, but in practice bounded by available memory. * * @param <T> - * The element type of the tape. + * The element type of the tape. * * @author bjculkin */ @@ -24,7 +24,7 @@ public interface Tape<T> { * Set the item the tape is currently on. * * @param itm - * The new value for the tape item. + * The new value for the tape item. */ void item(T itm); @@ -46,7 +46,7 @@ public interface Tape<T> { * Insert an element before the current item. * * @param itm - * The item to add. + * The item to add. */ void insertBefore(T itm); @@ -54,7 +54,7 @@ public interface Tape<T> { * Insert an element after the current item. * * @param itm - * The item to insert. + * The item to insert. */ void insertAfter(T itm); @@ -90,7 +90,7 @@ public interface Tape<T> { * that would exceed zero don't move the cursor at all. * * @param amt - * The amount to attempt to move the cursor left. + * The amount to attempt to move the cursor left. * * @return True if the cursor was moved left. */ @@ -107,14 +107,28 @@ public interface Tape<T> { * Move the cursor the specified amount right. * * @param amt - * The amount to move the cursor right by. + * The amount to move the cursor right by. * * @return Whether the cursor was moved right. */ boolean right(int amt); + /** + * Seek to an absolute position on the tape. + * + * @param pos + * The position to seek to. + * @return Whether or not the tape successfully seeked to that position. + */ boolean seekTo(int pos); + /** + * Check if this tape is at its end. + * + * Equivalent to checking if position() == size(). + * + * @return Whether or not the tape is at its end. + */ default boolean atEnd() { return position() == size(); } |
