com.hdcookbook.grin.util
Class Queue

java.lang.Object
  extended by com.hdcookbook.grin.util.Queue

public class Queue
extends java.lang.Object

This class maintains a queue that avoids generating heap traffic.

Author:
Bill Foote (http://jovial.com)

Constructor Summary
Queue(int capacity)
          Create a queue.
 
Method Summary
 void add(java.lang.Object el)
           
 boolean isEmpty()
           
 java.lang.Object remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue(int capacity)
Create a queue. It will fill up to the given capacity without creating any new objects. If the queue gets more entries than this, it will start allocating objects.

Method Detail

add

public void add(java.lang.Object el)

isEmpty

public boolean isEmpty()

remove

public java.lang.Object remove()
Throws:
java.util.NoSuchElementException - if isEmpty() is true