Package com.googlecode.javaewah
Class ChunkIteratorImpl
- java.lang.Object
-
- com.googlecode.javaewah.ChunkIteratorImpl
-
- All Implemented Interfaces:
ChunkIterator
final class ChunkIteratorImpl extends java.lang.Object implements ChunkIterator
The ChunkIteratorImpl is the 64 bit implementation of the ChunkIterator interface, which efficiently returns the chunks of ones and zeros represented by an EWAHIterator.
-
-
Field Summary
Fields Modifier and Type Field Description private Bufferbufferprivate EWAHIteratorewahIterprivate booleanhasNextprivate java.lang.BooleannextBitprivate intnextLengthprivate intpositionprivate booleanrunningBitprivate intrunningLengthprivate intsizeInBitsprivate longwordprivate intwordLengthprivate longwordMaskprivate intwordPosition
-
Constructor Summary
Constructors Constructor Description ChunkIteratorImpl(EWAHIterator ewahIter, int sizeInBits)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleancurrentWordBit()booleanhasNext()Is there more?private booleanhasNextRLW()private booleanliteralHasNext()voidmove()Move the iterator at the next different bitvoidmove(int bits)Move the iterator at the next ith bitprivate voidmovePosition(int offset)private booleanmoveToNextRLW()booleannextBit()Return the next bitintnextLength()Return the length of the next bitprivate RunningLengthWordnextRLW()private booleanrunningHasNext()private intrunningOffset()private voidsetRLW(RunningLengthWord rlw)private voidshiftWordMask()private voidupdateNext()
-
-
-
Field Detail
-
ewahIter
private final EWAHIterator ewahIter
-
sizeInBits
private final int sizeInBits
-
buffer
private final Buffer buffer
-
position
private int position
-
runningBit
private boolean runningBit
-
runningLength
private int runningLength
-
word
private long word
-
wordMask
private long wordMask
-
wordPosition
private int wordPosition
-
wordLength
private int wordLength
-
hasNext
private boolean hasNext
-
nextBit
private java.lang.Boolean nextBit
-
nextLength
private int nextLength
-
-
Constructor Detail
-
ChunkIteratorImpl
ChunkIteratorImpl(EWAHIterator ewahIter, int sizeInBits)
-
-
Method Detail
-
hasNext
public boolean hasNext()
Description copied from interface:ChunkIteratorIs there more?- Specified by:
hasNextin interfaceChunkIterator- Returns:
- true, if there is more, false otherwise
-
nextBit
public boolean nextBit()
Description copied from interface:ChunkIteratorReturn the next bit- Specified by:
nextBitin interfaceChunkIterator- Returns:
- the bit
-
nextLength
public int nextLength()
Description copied from interface:ChunkIteratorReturn the length of the next bit- Specified by:
nextLengthin interfaceChunkIterator- Returns:
- the length
-
move
public void move()
Description copied from interface:ChunkIteratorMove the iterator at the next different bit- Specified by:
movein interfaceChunkIterator
-
move
public void move(int bits)
Description copied from interface:ChunkIteratorMove the iterator at the next ith bit- Specified by:
movein interfaceChunkIterator- Parameters:
bits- the number of bits to skip
-
moveToNextRLW
private boolean moveToNextRLW()
-
setRLW
private void setRLW(RunningLengthWord rlw)
-
runningHasNext
private boolean runningHasNext()
-
literalHasNext
private boolean literalHasNext()
-
hasNextRLW
private boolean hasNextRLW()
-
nextRLW
private RunningLengthWord nextRLW()
-
updateNext
private void updateNext()
-
runningOffset
private int runningOffset()
-
movePosition
private void movePosition(int offset)
-
currentWordBit
private boolean currentWordBit()
-
shiftWordMask
private void shiftWordMask()
-
-