Package soot.util.queue
Class QueueReader<E>
- java.lang.Object
-
- soot.util.queue.QueueReader<E>
-
- All Implemented Interfaces:
Iterator<E>
public class QueueReader<E> extends Object implements Iterator<E>
A queue of Object's. One can add objects to the queue, and they are later read by a QueueReader. One can create arbitrary numbers of QueueReader's for a queue, and each one receives all the Object's that are added. Only objects that have not been read by all the QueueReader's are kept. A QueueReader only receives the Object's added to the queue after the QueueReader was created. This QueueReader doesnot acceptnullvalues.- Author:
- Ondrej Lhotak
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedQueueReader(E[] q, int index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueueReader<E>clone()booleanhasNext()Returns true iff there is currently another object in the queue.Enext()Returns (and removes) the next object in the queue, or null if there are none.voidremove()voidremove(E o)Removes an element from the underlying queue.voidremove(Collection<E> toRemove)Removes elements from the underlying queue.protected booleanskip(Object ret)StringtoString()-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
q
protected E[] q
-
index
protected int index
-
-
Constructor Detail
-
QueueReader
protected QueueReader(E[] q, int index)
-
-
Method Detail
-
next
public E next()
Returns (and removes) the next object in the queue, or null if there are none.
-
skip
protected boolean skip(Object ret)
-
hasNext
public boolean hasNext()
Returns true iff there is currently another object in the queue.
-
remove
public void remove(E o)
Removes an element from the underlying queue. This operation can only delete elements that have not yet been consumed by this reader.- Parameters:
o- The element to remove
-
remove
public void remove(Collection<E> toRemove)
Removes elements from the underlying queue. This operation can only delete elements that have not yet been consumed by this reader.- Parameters:
toRemove- The elements to remove
-
clone
public QueueReader<E> clone()
-
-