1 cananian 1.1 // Worklist.java, created Sat Sep 12 19:38:31 1998 by cananian 2 cananian 1.2 // Copyright (C) 1998 C. Scott Ananian <cananian@alumni.princeton.edu> 3 cananian 1.2 // Licensed under the terms of the GNU GPL; see COPYING for details. 4 cananian 1.1 package harpoon.Util; 5 cananian 1.1 6 cananian 1.1 /** 7 cananian 1.1 * A <code>Worklist</code> is a unique set. 8 cananian 1.1 * 9 cananian 1.1 * @author C. Scott Ananian <cananian@alumni.princeton.edu> 10 cananian 1.4 * @version $Id: Worklist.java,v 1.4 2002/04/10 03:07:05 cananian Exp $ 11 cananian 1.1 */ 12 cananian 1.3.2.1 public interface Worklist<E> { 13 pnkfelix 1.2.2.3 14 pnkfelix 1.2.2.3 /** Pushes an item onto the Worklist if it is not already there. 15 pnkfelix 1.2.2.3 <BR> <B>modifies:</B> <code>this</code> 16 pnkfelix 1.2.2.3 <BR> <B>effects:</B> If <code>item</code> is not already an 17 pnkfelix 1.2.2.3 element of <code>this</code>, adds 18 pnkfelix 1.2.2.5 <code>item</code> to <code>this</code>. 19 pnkfelix 1.2.2.5 Else does nothing. 20 pnkfelix 1.2.2.3 */ 21 cananian 1.3.2.1 public void push(E item); 22 cananian 1.1 23 pnkfelix 1.2.2.4 /** Removes some item from the Worklist and return it. 24 pnkfelix 1.2.2.3 <BR> <B>modifies:</B> <code>this</code> 25 pnkfelix 1.2.2.4 <BR> <B>effects:</B> If there exists an <code>Object</code>, 26 pnkfelix 1.2.2.4 <code>item</code>, that is an element of 27 pnkfelix 1.2.2.4 <code>this</code>, removes 28 pnkfelix 1.2.2.5 <code>item</code> from <code>this</code> 29 pnkfelix 1.2.2.5 and returns <code>item</code>. Else does 30 pnkfelix 1.2.2.5 nothing. 31 pnkfelix 1.2.2.3 */ 32 cananian 1.3.2.1 public E pull(); 33 pnkfelix 1.2.2.3 34 pnkfelix 1.2.2.3 /** Determines if the Worklist contains an item. 35 pnkfelix 1.2.2.3 <BR> <B>effects:</B> If <code>item</code> is an element of 36 pnkfelix 1.2.2.3 <code>this</code>, returns true. 37 pnkfelix 1.2.2.3 Else returns false. 38 pnkfelix 1.2.2.3 */ 39 cananian 1.1 public boolean contains(Object item); 40 pnkfelix 1.2.2.3 41 pnkfelix 1.2.2.3 /** Determines if there are any more items left in the Worklist. 42 pnkfelix 1.2.2.3 <BR> <B>effects:</B> If <code>this</code> has any elements, 43 pnkfelix 1.2.2.3 returns true. Else returns false. 44 pnkfelix 1.2.2.3 */ 45 cananian 1.1 public boolean isEmpty(); 46 cananian 1.1 } 47 cananian 1.3