Type
- protected final class IndexMultiTable.IteratorImpl
extends java.lang.Object
implements java.util.ListIterator<Type>
IndexMultiTable.iterator()
-call
produces one instance. It is possible to create some instances simultaneously.
The iterator iterates over all values in all tables, independent of their keys.
But because the values are sorted with the keys, the values are gotten in its key-sorted order.Modifier and Type | Field and Description |
---|---|
private boolean |
bLastWasNext
Information whether
next() or previous() was invoked at last. |
(package private) IndexMultiTable.IteratorHelper<Key,Type> |
helperNext
The helperNext and helperPrev contain the values of the iterator.
|
(package private) IndexMultiTable.IteratorHelper<Key,Type> |
helperPrev
The helperNext and helperPrev contain the values of the iterator.
|
(package private) Key |
lastKey
The value which is returned by the last
next() and previous() . |
(package private) Type |
lastValue |
private int |
modcount
Comparison of this value with
IndexMultiTable.modcount to detect changes. |
Constructor and Description |
---|
IteratorImpl()
Creates the iterator before the first element.
|
IteratorImpl(Key startKey)
Ctor for the Iterator which starts on any position inside the table.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Type e) |
private void |
checkForModification() |
boolean |
hasNext() |
boolean |
hasPrevious() |
(package private) Key |
lastKey() |
private void |
next_i()
executes the next(), on entry
bHasNextProcessed is false. |
Type |
next()
Implements the standard behavior for
Iterator.next() . |
int |
nextIndex() |
private void |
prev_i()
executes the next(), on entry
bHasNextProcessed is false. |
Type |
previous()
Implements the standard behavior for
Iterator.next() . |
int |
previousIndex() |
void |
remove() |
void |
set(Type value)
Sets a new value to the given key!
|
java.lang.String |
toString() |
IndexMultiTable.IteratorHelper<Key extends java.lang.Comparable<Key>,Type> helperPrev
IndexMultiTable.IteratorHelper<Key extends java.lang.Comparable<Key>,Type> helperNext
private final int modcount
IndexMultiTable.modcount
to detect changes.private boolean bLastWasNext
next()
or previous()
was invoked at last.
It is important for the functionality of remove()
, add(Object)
and set(Object)
If next()
was called at last, the last element or insertion point is that element which is referred by helperPrev
:
prev--+ +--next | , | [1] [2] [3] [4] | ^ | prev--+ +--nextnext() has returned [3]. The
remove()
operation has to remove the element at position 3, which is referred yet as the previous.
The operation set(Object)
should be changed the element at position [3].
prev--+ +--next | , | [1] [2] [3] [4] | ^ | prev--+ +--nextThe element [2] which is yet referred from
helperNext
should be deleted or after [2] is to change.Key extends java.lang.Comparable<Key> lastKey
next()
and previous()
.Type lastValue
IteratorImpl()
firstTable
- IteratorImpl(Key startKey)
previous()
is any element which's key is lesser or equal the given key.
The next element next()
is any element which's key is greater the given key.
The previous element is null hasPrevious()
== false if no element is found which is lesser or equal the given key.
The next element is null, hasNext()
== false if not element is found which's key is greater.firstTable
- The super table.startKey
- The keypublic boolean hasNext()
public boolean hasPrevious()
hasPrevious
in interface java.util.ListIterator<Type>
public Type next()
Iterator.next()
.
For internal usage the helperNext
is set.
With thempublic Type previous()
Iterator.next()
.
For internal usage the helperNext
is set.
With themprevious
in interface java.util.ListIterator<Type>
public int nextIndex()
nextIndex
in interface java.util.ListIterator<Type>
public int previousIndex()
previousIndex
in interface java.util.ListIterator<Type>
public void set(Type value)
set
in interface java.util.ListIterator<Type>
value
- Key lastKey()
private void checkForModification()
private void next_i()
bHasNextProcessed
is false.
If the table is a child table and its end is reached, this routine is called recursively
with the now current parent, typical the parent contains a child table
because the table is a hyper table. Than the child helperNext is initialized
and reused, and this routine will be called a third time, now with the new child:
child: end of table; parent: next table; child: test next table.If the tree of tables is deeper than two, and the end of a child and also the parent table is reached, this routine is called recursively more as three times. The maximum of recursively call depends on the deepness of the table tree.
private void prev_i()
bHasNextProcessed
is false.
If the table is a child table and its end is reached, this routine is called recursively
with the now current parent, typical the parent contains a child table
because the table is a hyper table. Than the child helperNext is initialized
and reused, and this routine will be called a third time, now with the new child:
child: end of table; parent: next table; child: test next table.If the tree of tables is deeper than two, and the end of a child and also the parent table is reached, this routine is called recursively more as three times. The maximum of recursively call depends on the deepness of the table tree.
public void remove()
public java.lang.String toString()
toString
in class java.lang.Object