writeattributes
Class AddressEdit.PriorityQueue.PQIterator

java.lang.Object
  extended by writeattributes.AddressEdit.PriorityQueue.PQIterator
All Implemented Interfaces:
java.util.Iterator
Enclosing class:
AddressEdit.PriorityQueue

private class AddressEdit.PriorityQueue.PQIterator
extends java.lang.Object
implements java.util.Iterator

Priority queue iterator.

An instance of this iterator can work in either the upward or downward direction. An upward iterator starts at queue element zero and returns queue elements at increasing indices. A downward iterator starts with the largest index and moves to lower indices.


Field Summary
private  int current
           
private  int end
           
private  int generation
           
private  int increment
           
private  AddressEdit.PriorityQueue queue
           
private  int start
           
 
Constructor Summary
AddressEdit.PriorityQueue.PQIterator(int direction, AddressEdit.PriorityQueue queue)
          Constructor.
 
Method Summary
 boolean hasNext()
          Is there another element to read?
 java.lang.Object next()
          Return next element, moving in desired direction.
 void remove()
          Remove an element from the underlying collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queue

private final AddressEdit.PriorityQueue queue

start

private final int start

end

private final int end

increment

private final int increment

generation

private final int generation

current

private int current
Constructor Detail

AddressEdit.PriorityQueue.PQIterator

public AddressEdit.PriorityQueue.PQIterator(int direction,
                                            AddressEdit.PriorityQueue queue)
Constructor.

Create an up iterator if the argument is greater than or equal to zero, otherwise create a down iterator.

Parameters:
direction - negative for down, otherwise up
queue - the priority queue to walk
Throws:
java.lang.IllegalArgumentException - if queue is null
Method Detail

hasNext

public boolean hasNext()
Is there another element to read?

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if next() won't throw an exception
Throws:
java.util.ConcurrentModificationException - if queue has been modified underneath iterator

next

public java.lang.Object next()
Return next element, moving in desired direction.

Specified by:
next in interface java.util.Iterator
Returns:
next AttributeRegion in the queue
Throws:
java.util.ConcurrentModificationException - if queue has been modified underneath iterator

remove

public void remove()
Remove an element from the underlying collection.

Not supported.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException