|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcoins.alias.util.BitVectorIterator
BitVectorIteratorImpl class: (##6)
This class offers methods for iterating over a BitVector instance. As BitVectors in general cannot be efficiently scanned, this class is just a compromise for when there is really a need to scan over a BitVector. If iteration performance is important, other data structures than a BitVector should be considered.
The iteration is implemented by maintaining and advancing the cursor position, which is the bit position of the underlying BitVector this BitVectorIterator currently has hold on.
The methods in this class do not necessarily throw appropriate exceptions; an instance of this class may silently enter an invalid state, so care should be taken.
Some of the methods' names (hasNext and next) are carried over from java.util.Iterator interface, but their behaviors may be different from what may be expected from their names.
| Constructor Summary | |
BitVectorIterator(BitVector pBitVector)
Creates a BitVectorIterator instance that scans the given argument. |
|
| Method Summary | |
int |
currentIndex()
Returns the current cursor position. |
boolean |
hasNext()
Returns true if the cursor is not at or beyond the end of the underlying BitVector. |
int |
next()
Returns the next bit position and advances the cursor by one. |
int |
nextIndex()
Returns the next bit position that is set and advances the cursor up to the returned position. |
void |
resetBit()
Resets the bit at the current cursor position. |
void |
setBit()
Sets the bit at the current cursor position. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BitVectorIterator(BitVector pBitVector)
BitVectorIterator instance that scans the given argument. The cursor position (returned by currentIndex) is set to -1.
pBitVector - the BitVector this BitVectorIterator scans.| Method Detail |
public boolean hasNext()
true if the cursor is not at or beyond the end of the underlying BitVector. (In other words, returns true if next would return a number less than the length of the underlying BitVector.)
public int next()
public int nextIndex()
public int currentIndex()
public void resetBit()
public void setBit()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||