/** * A stub implementation of cursored lists. * * @author Samuel A. Rebelsky * @version 1.1 of November 1999 */ public class StubList implements CursoredList { /** * Add an element to the end of the list. */ public void addToEnd(Object element) { // STUB } // addToEnd(Object) /** * Add an element to the front of the list. */ public void addToFront(Object element) { // STUB } // addToFront(Object) /** * Add an element after the current element. */ public void addAfterCursor(Object element) { // STUB } // addAfterCursor(Object) /** * Delete the current element. */ public void delete() { } // delete() /** * Move the cursor to the next element in the list equal * to the specified element. */ public void find(Object findMe) throws Exception { // STUB: One out of four times, throw an exception if (Math.random() < 0.25) { throw new Exception("At end of list"); } } // find(Object) /** * Move the cursor to the next element in the list equal * to the specified element, using compare for comparisons. */ public void find(Object findMe, Comparator compare) throws Exception { // STUB: One out of four times, throw an exception if (Math.random() < 0.25) { throw new Exception("At end of list"); } } // find(Object,Comparator) /** * Move the cursor to the front of the list. */ public void front() { // STUB } // front() /** * Get the current element of the list. * Pre: There is a current element (specified by the cursor). */ public Object getCurrent() { return "TESTING"; // STUB } // getCurrent() /** * Advance the cursor to the next elmeent. */ public void advance() throws Exception { // STUB: One out of four times, throw an exception if (Math.random() < 0.25) { throw new Exception("At end of list"); } } // advance() } // class StubList