Package com.mckoi.util
Class AbstractBlockIntegerList.BILIterator
- java.lang.Object
-
- com.mckoi.util.AbstractBlockIntegerList.BILIterator
-
- All Implemented Interfaces:
IntegerIterator
- Enclosing class:
- AbstractBlockIntegerList
private final class AbstractBlockIntegerList.BILIterator extends java.lang.Object implements IntegerIterator
Our iterator that walks through the list.
-
-
Field Summary
Fields Modifier and Type Field Description private int
block_index
private int
block_offset
private int
cur_offset
private IntegerListBlockInterface
current_block
private int
current_block_size
private int
end_offset
private int
start_offset
-
Constructor Summary
Constructors Constructor Description BILIterator(int start_offset, int end_offset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Returns true if this list iterator has more elements when traversing the list in the forward direction.boolean
hasPrevious()
Returns true if this list iterator has more elements when traversing the list in the reverse direction.int
next()
Returns the next element in the list.int
previous()
Returns the previous element in the list.void
remove()
Removes from the list the last element returned by the iterator.private void
setupVars(int pos)
Sets up the internal variables given an offset.private void
walkBack()
-
-
-
Field Detail
-
start_offset
private int start_offset
-
end_offset
private int end_offset
-
current_block
private IntegerListBlockInterface current_block
-
current_block_size
private int current_block_size
-
block_index
private int block_index
-
block_offset
private int block_offset
-
cur_offset
private int cur_offset
-
-
Method Detail
-
setupVars
private void setupVars(int pos)
Sets up the internal variables given an offset.
-
hasNext
public boolean hasNext()
Description copied from interface:IntegerIterator
Returns true if this list iterator has more elements when traversing the list in the forward direction. (In other words, returns true if next would return an element rather than throwing an exception.)- Specified by:
hasNext
in interfaceIntegerIterator
-
next
public int next()
Description copied from interface:IntegerIterator
Returns the next element in the list. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)- Specified by:
next
in interfaceIntegerIterator
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:IntegerIterator
Returns true if this list iterator has more elements when traversing the list in the reverse direction. (In other words, returns true if previous would return an element rather than throwing an exception.)- Specified by:
hasPrevious
in interfaceIntegerIterator
-
walkBack
private void walkBack()
-
previous
public int previous()
Description copied from interface:IntegerIterator
Returns the previous element in the list. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)- Specified by:
previous
in interfaceIntegerIterator
-
remove
public void remove()
Description copied from interface:IntegerIterator
Removes from the list the last element returned by the iterator. This method can be called only once per call to 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.Some implementations of IntegerIterator may choose to not implement this method, in which case an appropriate exception is generated.
- Specified by:
remove
in interfaceIntegerIterator
-
-