From 9052ed6da37af23ea82588d248f409e60a33c6cb Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Sun, 12 Apr 2020 13:13:42 -0400 Subject: Finish up extraction This applies the changes that were necessary to complete the extraction of these packages from bjc-utils --- src/main/java/bjc/esodata/Tape.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main/java/bjc/esodata/Tape.java') diff --git a/src/main/java/bjc/esodata/Tape.java b/src/main/java/bjc/esodata/Tape.java index 080e216..7d5fd9a 100644 --- a/src/main/java/bjc/esodata/Tape.java +++ b/src/main/java/bjc/esodata/Tape.java @@ -132,4 +132,20 @@ public interface Tape { default boolean atEnd() { return position() == size(); } + + /** + * Append an item to the tape. + * + * By default, uses a fairly non-performant implementation. Should be overidden in subclasses to be more performant. + * @param itm The item to append. + */ + default void append(T itm) { + int pos = position(); + + last(); + + insertAfter(itm); + + seekTo(pos); + } } -- cgit v1.2.3