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 intblock_indexprivate intblock_offsetprivate intcur_offsetprivate IntegerListBlockInterfacecurrent_blockprivate intcurrent_block_sizeprivate intend_offsetprivate intstart_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 booleanhasNext()Returns true if this list iterator has more elements when traversing the list in the forward direction.booleanhasPrevious()Returns true if this list iterator has more elements when traversing the list in the reverse direction.intnext()Returns the next element in the list.intprevious()Returns the previous element in the list.voidremove()Removes from the list the last element returned by the iterator.private voidsetupVars(int pos)Sets up the internal variables given an offset.private voidwalkBack()
-
-
-
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:IntegerIteratorReturns 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:
hasNextin interfaceIntegerIterator
-
next
public int next()
Description copied from interface:IntegerIteratorReturns 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:
nextin interfaceIntegerIterator
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:IntegerIteratorReturns 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:
hasPreviousin interfaceIntegerIterator
-
walkBack
private void walkBack()
-
previous
public int previous()
Description copied from interface:IntegerIteratorReturns 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:
previousin interfaceIntegerIterator
-
remove
public void remove()
Description copied from interface:IntegerIteratorRemoves 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:
removein interfaceIntegerIterator
-
-