|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--com.sosnoski.util.GrowableBase
|
+--com.sosnoski.util.queue.QueueBase
|
+--com.sosnoski.util.queue.ObjectQueue
Growable circular queue of Objects. This implementation is
unsynchronized in order to provide the best possible performance for typical
usage scenarios, so explicit synchronization must be implemented by a
wrapper class or directly by the application in cases where instances are
modified in a multithreaded environment. See the base classes for other
details of the implementation.
| Field Summary | |
protected java.lang.Object[] |
m_baseArray
The underlying array used for storing the data. |
| Fields inherited from class com.sosnoski.util.queue.QueueBase |
m_emptyOffset, m_fillOffset |
| Fields inherited from class com.sosnoski.util.GrowableBase |
DEFAULT_SIZE, m_countLimit, m_maximumGrowth |
| Constructor Summary | |
ObjectQueue()
Default constructor. |
|
ObjectQueue(int size)
Constructor with partial specification. |
|
ObjectQueue(int size,
int growth)
Constructor with full specification. |
|
ObjectQueue(ObjectQueue base)
Copy (clone) constructor. |
|
| Method Summary | |
void |
add(java.lang.Object item)
Add an item at the end of the queue. |
java.lang.Object |
clone()
Duplicates the object with the generic call. |
protected java.lang.Object |
getArray()
Get the backing array. |
java.util.Iterator |
iterator()
Return an iterator for the Objects in this queue. |
java.lang.Object |
remove()
Remove an item from the start of the queue. |
protected void |
setArray(java.lang.Object array)
Set the backing array. |
java.lang.Object[] |
toArray()
Constructs and returns a simple array containing the same data as held in this growable array. |
java.lang.Object[] |
toArray(java.lang.Class type)
Constructs and returns a type-specific array containing the same data as held in this growable generic array. |
| Methods inherited from class com.sosnoski.util.queue.QueueBase |
buildArray, clear, discard, getAddIndex, getRemoveIndex, isEmpty, resizeCopy, size |
| Methods inherited from class com.sosnoski.util.GrowableBase |
buildArray, discardValues, ensureCapacity, growArray |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.Object[] m_baseArray
| Constructor Detail |
public ObjectQueue(int size,
int growth)
size - number of elements initially allowed in queuegrowth - maximum size increment for growing queuepublic ObjectQueue(int size)
size - number of elements initially allowed in queuepublic ObjectQueue()
public ObjectQueue(ObjectQueue base)
base - instance being copied| Method Detail |
protected java.lang.Object getArray()
getArray in class GrowableBaseprotected void setArray(java.lang.Object array)
setArray in class GrowableBasebacking - array objectpublic void add(java.lang.Object item)
item - item to be addedpublic java.lang.Object remove()
IllegalStateException - on attempt to remove an item from an
empty queuepublic final java.util.Iterator iterator()
Objects in this queue. The
iterator returns all values in order, but is not "live". Values
added to the queue during iteration will not be returned by the
iteration, and any other changes to the queue while the iteration is
in progress will give indeterminant results.public java.lang.Object[] toArray()
public java.lang.Object[] toArray(java.lang.Class type)
type - element type for constructed arraypublic java.lang.Object clone()
clone in class java.lang.Object
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||