Package com.tangosol.util
Class Dequeue
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.Dequeue
- All Implemented Interfaces:
Serializable,Cloneable,Enumeration,Iterator
Represents a double-ended queue (dequeue) of objects. A dequeue allows
items which have been removed from the front of the queue to be put back
on the front of the queue.
- Version:
- 1.00, 12/05/96
- Author:
- Cameron Purdy
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddElement(Object o) Adds an element to the dequeue.intcapacity()Determine the current capacity of this dequeue.clone()Creates a clone of the dequeue.protected voidgrow()Increase the capacity of the Dequeue.booleanDetermines if the Dequeue contains more elements.booleanhasNext()Tests if this Iterator contains more elements.booleanisEmpty()Determines if the dequeue is empty.booleanisFull()Determines if the dequeue is full.next()Returns the next element of this Iterator.protected intnext(int i) Determines the index following the passed index for storing or accessing an item from the m_ao storage.Returns the next element from the Dequeue.protected intprev(int i) Determines the index preceding the passed index for storing or accessing an item from the m_ao storage.voidReturns the most recently returned element to the Dequeue.voidremove()Remove the last-returned element that was returned by the Iterator.voidRemoves all items from the dequeue.intsize()Determine the current number of objects in this dequeue.Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, waitMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Enumeration
asIteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
Dequeue
public Dequeue()Constructs a dequeue.
-
-
Method Details
-
hasMoreElements
public boolean hasMoreElements()Determines if the Dequeue contains more elements.- Specified by:
hasMoreElementsin interfaceEnumeration- Returns:
- true if Dequeue contains more elements, false otherwise
-
nextElement
Returns the next element from the Dequeue. Calls to this method will enumerate successive elements.- Specified by:
nextElementin interfaceEnumeration- Returns:
- the next element
- Throws:
NoSuchElementException- If no more elements exist.
-
hasNext
public boolean hasNext()Tests if this Iterator contains more elements. -
next
Returns the next element of this Iterator. -
remove
public void remove()Remove the last-returned element that was returned by the Iterator. This method always throws UnsupportedOperationException because the Iterator is immutable. -
addElement
Adds an element to the dequeue. The passed object is placed at the end of the dequeue.- Parameters:
o- object to add to the Dequeue
-
putBackElement
Returns the most recently returned element to the Dequeue. After calling this method, a call to nextElement will return the element that was returned by the most recent call to nextElement. This method can be called multiple times to put back multiple elements.- Parameters:
o- the object- Throws:
NoSuchElementException- If the element that is being put back is no longer in the Dequeue.
-
removeAllElements
public void removeAllElements()Removes all items from the dequeue. -
capacity
public int capacity()Determine the current capacity of this dequeue.- Returns:
- the current capacity of this dequeue
-
size
public int size()Determine the current number of objects in this dequeue.- Returns:
- the current number of objects in this dequeue
-
isEmpty
public boolean isEmpty()Determines if the dequeue is empty.- Returns:
- true if the dequeue is empty, false otherwise
-
isFull
public boolean isFull()Determines if the dequeue is full. This method is mainly of use internally, since the dequeue auto-resizes when additional items are added.- Returns:
- true if the dequeue is full, false otherwise
-
clone
Creates a clone of the dequeue. -
next
protected int next(int i) Determines the index following the passed index for storing or accessing an item from the m_ao storage.- Parameters:
i- the index- Returns:
- the next index
-
prev
protected int prev(int i) Determines the index preceding the passed index for storing or accessing an item from the m_ao storage.- Parameters:
i- the index- Returns:
- the previous index
-
grow
protected void grow()Increase the capacity of the Dequeue.
-