// The interface for stacks. // (c) 1998, 2001 duane a. bailey package structure; /** * An abstract structure implementing features common to all first-in, first-out * structures in this package. * Queues are typically used to process values in the order that they appear * and to store the state of buffered objects. * The structure package provides several implementations of the Queue interface, * each of which has its particular strengths and weaknesses. *
* Example usage: *
* To compute the sum of the unicode value of every character in the standard input * we could use the following: *
*
* public static void main(String[] arguments) * { * {@link AbstractQueue} q = new {@link QueueList#QueueList() QueueList()}; * int unicodeSum = 0; * * if(arguments.length > 0){ * for(int i=0; i < arguments.length; i++){ * for(int j=0; j < arguments[i].length(); j++){ * q.{@link #enqueue(Object) enqueue(new Character(arguments[i].charAt(j)))}; * } * } * } * * while(!q.{@link #empty()}){ * char c = ((Character)q.{@link #dequeue()}).charValue(); * unicodeSum+=Character.getNumericValue(c); * } * * System.out.println("Total Value: " + unicodeSum); * } ** @see QueueArray * @see QueueVector * @see QueueList * @version $Id: AbstractQueue.java,v 1.2 2005/10/18 19:47:18 terescoj Exp $ * @author, 2001 duane a. bailey */ //+implementation public abstract class AbstractQueue