com.g11ntoolkit.util
Class Arguments.Queue

java.lang.Object
  |
  +--com.g11ntoolkit.util.Arguments.Queue
Enclosing class:
Arguments

private class Arguments.Queue
extends java.lang.Object

Private class to handle the queue of arguments.

Version:
2005/06/20
Author:
Jeffrey Rodriguez, The Apache Software Foundation..
, Bill Rich, Wilandra Consulting LLC
Copyright © 2001-2005, Wilandra Consulting LLC. All rights reserved.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See License Agreement.


Field Summary
private  int front
          The index of the first item in the queue.
private  int items
          The number of items in the queue.
private  java.util.logging.Logger log
          The log used for all messages from this class.
private  int max
          The maximum number of items that will fit in the queue.
private  java.lang.Object[] queue
          LinkedList queue.
private  int rear
          The index of the last item in the queue.
 
Constructor Summary
Arguments.Queue(int size)
          Creates a Queue object to contain the specified number of items.
 
Method Summary
 void clear()
          Clears all the items from the queue.
 boolean empty()
          Returns true if the queue is empty.
 java.lang.Object pop()
          Removes an item from the queue.
 void print()
          Prints the items in the queue on the console.
 void push(java.lang.Object token)
          Places the specified token on the queue.
 int size()
          Returns the number of items in the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private java.util.logging.Logger log
The log used for all messages from this class.


queue

private java.lang.Object[] queue
LinkedList queue.


max

private int max
The maximum number of items that will fit in the queue.


front

private int front
The index of the first item in the queue.


rear

private int rear
The index of the last item in the queue.


items

private int items
The number of items in the queue.

Constructor Detail

Arguments.Queue

public Arguments.Queue(int size)
Creates a Queue object to contain the specified number of items.

Parameters:
size - an int specifying how many items will be placed in the queue
Method Detail

push

public void push(java.lang.Object token)
Places the specified token on the queue.

If the queue runs out of space, extend it.

Parameters:
token - an Object specifying the item to be placed on the queue
See Also:
Arguments.maxIncrement

pop

public java.lang.Object pop()
Removes an item from the queue.

Returns:
an Object representing the item removed from the queue or null if no items are in the queue

empty

public boolean empty()
Returns true if the queue is empty.

Returns:
a boolean representing whether the queue is empty (true) or not (false)

size

public int size()
Returns the number of items in the queue.

Returns:
an int specifying the number of items currently in the queue

clear

public void clear()
Clears all the items from the queue.


print

public void print()
Prints the items in the queue on the console.

Each item in the queue is printed on a separate line.