Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Class Dequeue

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.Dequeue

All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Enumeration, java.util.Iterator

public class Dequeue
extends Base
implements java.util.Enumeration, java.util.Iterator, java.lang.Cloneable, java.io.Serializable

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

Constructor Summary
Dequeue()
          Constructs a dequeue.

 

Method Summary
 void addElement(java.lang.Object o)
          Adds an element to the dequeue.
 int capacity()
          Determine the current capacity of this dequeue.
 java.lang.Object clone()
          Creates a clone of the dequeue.
protected  void grow()
          Increase the capacity of the Dequeue.
 boolean hasMoreElements()
          Determines if the Dequeue contains more elements.
 boolean hasNext()
          Tests if this Iterator contains more elements.
 boolean isEmpty()
          Determines if the dequeue is empty.
 boolean isFull()
          Determines if the dequeue is full.
 java.lang.Object next()
          Returns the next element of this Iterator.
protected  int next(int i)
          Determines the index following the passed index for storing or accessing an item from the m_ao storage.
 java.lang.Object nextElement()
          Returns the next element from the Dequeue.
protected  int prev(int i)
          Determines the index preceding the passed index for storing or accessing an item from the m_ao storage.
 void putBackElement(java.lang.Object o)
          Returns the most recently returned element to the Dequeue.
 void remove()
          Remove the last-returned element that was returned by the Iterator.
 void removeAllElements()
          Removes all items from the dequeue.
 int size()
          Determine the current number of objects in this dequeue.

 

Constructor Detail

Dequeue

public Dequeue()
Constructs a dequeue.

Method Detail

hasMoreElements

public boolean hasMoreElements()
Determines if the Dequeue contains more elements.
Specified by:
hasMoreElements in interface java.util.Enumeration
Returns:
true if Dequeue contains more elements, false otherwise

nextElement

public java.lang.Object nextElement()
                             throws java.util.NoSuchElementException
Returns the next element from the Dequeue. Calls to this method will enumerate successive elements.
Specified by:
nextElement in interface java.util.Enumeration
Returns:
the next element
Throws:
java.util.NoSuchElementException - If no more elements exist.

hasNext

public boolean hasNext()
Tests if this Iterator contains more elements.
Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the Iterator contains more elements, false otherwise

next

public java.lang.Object next()
Returns the next element of this Iterator.
Specified by:
next in interface java.util.Iterator
Returns:
the next element in the 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.
Specified by:
remove in interface java.util.Iterator

addElement

public void addElement(java.lang.Object o)
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

public void putBackElement(java.lang.Object o)
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.
Throws:
java.util.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

public java.lang.Object clone()
Creates a clone of the dequeue.
Returns:
the clone

next

protected int next(int i)
Determines the index following the passed index for storing or accessing an item from the m_ao storage.
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.
Returns:
the previous index

grow

protected void grow()
Increase the capacity of the Dequeue.

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.