package rebelsky.list; /** * Simple cursors for array-based simple lists. * * @author CSC152 2004F */ class SimpleNodeCursor implements SimpleCursor { // +--------+------------------------------------------------------------ // | Fields | // +--------+ /** * The list that we iterate. */ SimpleLinkedList list; /** * The node that represents the current position in the list. */ Node pos; // +--------------+------------------------------------------------------ // | Constructors | // +--------------+ /** * Construct the cursor. */ public SimpleNodeCursor(SimpleLinkedList _list) { this.list = _list; this.pos = this.list.front; } // SimpleNodeCursor // +---------+----------------------------------------------------------- // | Methods | // +---------+ /** * Get a value not yet visited by this cursor. See * interface for more details. */ public Object next() throws NoSuchPosition { // Get the thing at the current position Object tmp = this.pos.data; // Advance to the next thing this.pos = this.pos.next; // Return the thing you found return tmp; } // next() /** * Determine whether or not unvisited elements remain. * See interface for more details. */ public boolean hasNext() { // STUB return false; } // hasNext() } // class SimpleNodeCursor