protected class AbstractSparseArray.Crawler extends Object implements LongArray.Iterator<V>, Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected static int |
ABOVE |
protected AbstractSparseArray.Node<V> |
current |
protected boolean |
fForward |
protected int |
fromdir |
protected static int |
LEFT |
protected static int |
RIGHT |
protected static int |
SITTING |
| Modifier | Constructor and Description |
|---|---|
protected |
Crawler(AbstractSparseArray.Node<V> head,
int fromdir,
boolean fForward)
Crawler constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Make a shallow copy of the node crawler.
|
protected AbstractSparseArray.Node<V> |
currentNode()
Returns the current Node in the iteration.
|
long |
getIndex()
Returns the index of the current value, which is the value returned
by the most recent call to the
next method. |
V |
getValue()
Returns the current value, which is the same value returned by the
most recent call to the
next method, or the most recent
value passed to setValue if setValue were called
after the next method. |
boolean |
hasNext()
Returns
true if the iteration has more elements. |
V |
next()
Returns the next element in the iteration.
|
protected AbstractSparseArray.Node<V> |
nextNode()
Returns the next Node in the iteration.
|
void |
remove()
Removes from the underlying collection the last element returned by
the iterator (optional operation).
|
V |
setValue(V oValue)
Stores a new value at the current value index, returning the value
that was replaced.
|
String |
toString()
Provide a string representation of this node's value.
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEachRemainingprotected static final int ABOVE
protected static final int LEFT
protected static final int SITTING
protected static final int RIGHT
protected AbstractSparseArray.Node<V> current
protected int fromdir
protected final boolean fForward
protected Crawler(AbstractSparseArray.Node<V> head, int fromdir, boolean fForward)
head - the node at which to start crawlingfromdir - the direction in which to start crawlingfForward - true iff crawler should advance forward towards
the next elementpublic boolean hasNext()
true if the iteration has more elements. (In other
words, returns true if next would return an
element rather than throwing an exception.)public V next()
next in interface LongArray.Iterator<V>next in interface Iterator<V>NoSuchElementException - iteration has no more elementspublic long getIndex()
next method.getIndex in interface LongArray.Iterator<V>IllegalStateException - if the next method has
not yet been called, or the remove method has
already been called after the last call to the
next method.public V getValue()
next method, or the most recent
value passed to setValue if setValue were called
after the next method.getValue in interface LongArray.Iterator<V>IllegalStateException - if the next method has
not yet been called, or the remove method has
already been called after the last call to the
next method.public V setValue(V oValue)
getIndex method.setValue in interface LongArray.Iterator<V>oValue - the new value to storeIllegalStateException - if the next method has
not yet been called, or the remove method has
already been called after the last call to the
next method.public void remove()
next. The behavior of an iterator is
unspecified if the underlying collection is modified while the
iteration is in progress in any way other than by calling this
method.remove in interface LongArray.Iterator<V>remove in interface Iterator<V>UnsupportedOperationException - if the remove
operation is not supported by this IteratorIllegalStateException - if the next method has
not yet been called, or the remove method has
already been called after the last call to the
next method.public String toString()
public Object clone()
protected AbstractSparseArray.Node<V> nextNode()
NoSuchElementException - iteration has no more elementsprotected AbstractSparseArray.Node<V> currentNode()
IllegalStateException - if the next method has
not yet been called, or the remove method has
already been called after the last call to the
next method.