package plp.collection; import java.util.Iterator; import java.util.NoSuchElementException; import plp.util.Predicate; /** * A list of Strings with cursor. * Elements are inserted or removed following the position of the cursor. * This version implements a position facility and an iterator. */ public class StringList implements CList { private ObjectList delegate; public StringList() { delegate = new ObjectList(); } public int size() { return delegate.size(); } public boolean empty() { return delegate.empty(); } public void insert(String s) { delegate.insert(s); } public void replace(String s) throws InvalidPositionException { delegate.replace(s); } public void remove() throws InvalidPositionException { delegate.remove(); } public void goFirst() { delegate.goFirst(); } public void goEnd() { delegate.goEnd(); } public void goTo(Position pos) throws InvalidPositionException { delegate.goTo(pos); } public Position getPosition() { return delegate.getPosition(); } public boolean atFirst() { return delegate.atFirst(); } public boolean atEnd() { return delegate.atEnd(); } public void forward() throws InvalidPositionException { delegate.forward(); } public void backward() throws InvalidPositionException { delegate.backward(); } public String get() throws InvalidPositionException { return (String) delegate.get(); } public Iterator iterator() { return delegate.iterator(); } public Iterator iterator(Predicate p) { return delegate.iterator(p); } public String toString() { return delegate.toString(); } }