org.apache.mina.util
Class CircularQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by org.apache.mina.util.CircularQueue<E>
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, List<E>, Queue<E>

public class CircularQueue<E>
extends AbstractList<E>
implements List<E>, Queue<E>, Serializable

A unbounded circular queue based on array.

Version:
$Rev: 662890 $, $Date: 2008-06-03 23:14:21 +0200 (mar, 03 jun 2008) $
Author:
The Apache MINA Project (dev@mina.apache.org)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CircularQueue()
          Construct a new, empty queue.
CircularQueue(int initialCapacity)
           
 
Method Summary
 boolean add(E o)
           
 void add(int idx, E o)
           
 int capacity()
          Returns the capacity of this queue.
 void clear()
           
 E element()
           
 E get(int idx)
           
 boolean isEmpty()
           
 boolean offer(E item)
           
 E peek()
           
 E poll()
           
 E remove()
           
 E remove(int idx)
           
 E set(int idx, E o)
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, addAll, contains, containsAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, subList, toArray, toArray
 

Constructor Detail

CircularQueue

public CircularQueue()
Construct a new, empty queue.


CircularQueue

public CircularQueue(int initialCapacity)
Method Detail

capacity

public int capacity()
Returns the capacity of this queue.


clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface List<E>
Overrides:
clear in class AbstractList<E>

poll

public E poll()
Specified by:
poll in interface Queue<E>

offer

public boolean offer(E item)
Specified by:
offer in interface Queue<E>

peek

public E peek()
Specified by:
peek in interface Queue<E>

get

public E get(int idx)
Specified by:
get in interface List<E>
Specified by:
get in class AbstractList<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface List<E>
Overrides:
isEmpty in class AbstractCollection<E>

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface List<E>
Specified by:
size in class AbstractCollection<E>

toString

public String toString()
Overrides:
toString in class AbstractCollection<E>

add

public boolean add(E o)
Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Specified by:
add in interface Queue<E>
Overrides:
add in class AbstractList<E>

set

public E set(int idx,
             E o)
Specified by:
set in interface List<E>
Overrides:
set in class AbstractList<E>

add

public void add(int idx,
                E o)
Specified by:
add in interface List<E>
Overrides:
add in class AbstractList<E>

remove

public E remove(int idx)
Specified by:
remove in interface List<E>
Overrides:
remove in class AbstractList<E>

remove

public E remove()
Specified by:
remove in interface Queue<E>

element

public E element()
Specified by:
element in interface Queue<E>


Copyright © 2004-2008 Apache MINA Project. All Rights Reserved.