choco.kernel.common.util.objects
Class CircularQueue<E>

java.lang.Object
  extended by choco.kernel.common.util.objects.CircularQueue<E>

public class CircularQueue<E>
extends Object

User : cprudhom Mail : cprudhom(a)emn.fr Date : 15 f�vr. 2010 Since : Choco 2.1.1

See Also:
{http://www.javaspecialists.eu/archive/Issue027.html}

Field Summary
protected  int modCount
          The number of times this list has been structurally modified.
 
Constructor Summary
CircularQueue()
           
CircularQueue(int size)
           
 
Method Summary
 boolean add(E e)
           
 void clear()
           
 boolean contains(Object elem)
           
 void ensureCapacity(int minCapacity)
           
 E get(int index)
           
 int indexOf(Object elem)
           
 boolean isEmpty()
           
 int lastIndexOf(Object elem)
           
 E poll()
           
 E pop()
           
 void remove(E elt)
           
 E remove(int index)
           
 int size()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modCount

protected transient int modCount
The number of times this list has been structurally modified. Structural modifications are those that change the size of the list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.

This field is used by the iterator and list iterator implementation returned by the iterator and listIterator methods. If the value of this field changes unexpectedly, the iterator (or list iterator) will throw a ConcurrentModificationException in response to the next, remove, previous, set or add operations. This provides fail-fast behavior, rather than non-deterministic behavior in the face of concurrent modification during iteration.

Use of this field by subclasses is optional. If a subclass wishes to provide fail-fast iterators (and list iterators), then it merely has to increment this field in its add(int,E) and remove(int) methods (and any other methods that it overrides that result in structural modifications to the list). A single call to add(int,E) or remove(int) must add no more than one to this field, or the iterators (and list iterators) will throw bogus ConcurrentModificationExceptions. If an implementation does not wish to provide fail-fast iterators, this field may be ignored.

Constructor Detail

CircularQueue

public CircularQueue()

CircularQueue

public CircularQueue(int size)
Method Detail

isEmpty

public boolean isEmpty()

ensureCapacity

public void ensureCapacity(int minCapacity)

size

public int size()

contains

public boolean contains(Object elem)

indexOf

public int indexOf(Object elem)

lastIndexOf

public int lastIndexOf(Object elem)

toArray

public <T> T[] toArray(T[] a)

get

public E get(int index)

add

public boolean add(E e)

pop

public E pop()

poll

public E poll()

remove

public E remove(int index)

remove

public void remove(E elt)

clear

public void clear()


Copyright © 2012. All Rights Reserved.