Package com.googlecode.javaewah
Class BufferedIterator
- java.lang.Object
-
- com.googlecode.javaewah.BufferedIterator
-
- All Implemented Interfaces:
IteratingRLW
,Cloneable
public class BufferedIterator extends Object implements IteratingRLW, Cloneable
This class can be used to iterate over blocks of bitmap data.- Author:
- Daniel Lemire
-
-
Constructor Summary
Constructors Constructor Description BufferedIterator(CloneableIterator<EWAHIterator> iterator)
Instantiates a new iterating buffered running length word.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferedIterator
clone()
void
discardFirstWords(long x)
Discard first words, iterating to the next running length word if needed.void
discardLiteralWords(long x)
Discard x literal words (assumes that there is no running word)void
discardRunningWords()
Discard all running wordslong
getLiteralWordAt(int index)
Get the nth literal word for the current running length wordint
getNumberOfLiteralWords()
Gets the number of literal words for the current running length word.boolean
getRunningBit()
Gets the running bit.long
getRunningLength()
Gets the running length.boolean
next()
Move to the next RunningLengthWordlong
size()
Size in uncompressed words of the current running length word.
-
-
-
Constructor Detail
-
BufferedIterator
public BufferedIterator(CloneableIterator<EWAHIterator> iterator)
Instantiates a new iterating buffered running length word.- Parameters:
iterator
- iterator
-
-
Method Detail
-
discardFirstWords
public void discardFirstWords(long x)
Discard first words, iterating to the next running length word if needed.- Specified by:
discardFirstWords
in interfaceIteratingRLW
- Parameters:
x
- the number of words to be discarded
-
discardLiteralWords
public void discardLiteralWords(long x)
Description copied from interface:IteratingRLW
Discard x literal words (assumes that there is no running word)- Specified by:
discardLiteralWords
in interfaceIteratingRLW
- Parameters:
x
- the number of words to discard
-
discardRunningWords
public void discardRunningWords()
Description copied from interface:IteratingRLW
Discard all running words- Specified by:
discardRunningWords
in interfaceIteratingRLW
-
next
public boolean next()
Move to the next RunningLengthWord- Specified by:
next
in interfaceIteratingRLW
- Returns:
- whether the move was possible
-
getLiteralWordAt
public long getLiteralWordAt(int index)
Get the nth literal word for the current running length word- Specified by:
getLiteralWordAt
in interfaceIteratingRLW
- Parameters:
index
- zero based index- Returns:
- the literal word
-
getNumberOfLiteralWords
public int getNumberOfLiteralWords()
Gets the number of literal words for the current running length word.- Specified by:
getNumberOfLiteralWords
in interfaceIteratingRLW
- Returns:
- the number of literal words
-
getRunningBit
public boolean getRunningBit()
Gets the running bit.- Specified by:
getRunningBit
in interfaceIteratingRLW
- Returns:
- the running bit
-
getRunningLength
public long getRunningLength()
Gets the running length.- Specified by:
getRunningLength
in interfaceIteratingRLW
- Returns:
- the running length
-
size
public long size()
Size in uncompressed words of the current running length word.- Specified by:
size
in interfaceIteratingRLW
- Returns:
- the size
-
clone
public BufferedIterator clone() throws CloneNotSupportedException
- Specified by:
clone
in interfaceIteratingRLW
- Overrides:
clone
in classObject
- Returns:
- a copy of the iterator
- Throws:
CloneNotSupportedException
- this should not be thrown in theory
-
-