com.googlecode.javaewah32
Class IteratingBufferedRunningLengthWord32

java.lang.Object
  extended by com.googlecode.javaewah32.IteratingBufferedRunningLengthWord32

public final class IteratingBufferedRunningLengthWord32
extends Object

Mostly for internal use. Similar to BufferedRunningLengthWord32, but automatically advances to the next BufferedRunningLengthWord32 as words are discarded.

Since:
0.5.0
Author:
Daniel Lemire and David McIntosh

Constructor Summary
IteratingBufferedRunningLengthWord32(EWAHCompressedBitmap32 bitmap)
          Instantiates a new iterating buffered running length word.
IteratingBufferedRunningLengthWord32(EWAHIterator32 iterator)
          Instantiates a new iterating buffered running length word.
 
Method Summary
 void discardFirstWords(int x)
          Discard first words, iterating to the next running length word if needed.
 void discharge(BitmapStorage32 container)
          Write out the remaining words
 int discharge(BitmapStorage32 container, int max)
          Write out up to max words, returns how many were written
protected static void discharge(BufferedRunningLengthWord32 initialWord, EWAHIterator32 iterator, BitmapStorage32 container)
          For internal use.
 void dischargeAsEmpty(BitmapStorage32 container)
          Write out the remain words, transforming them to zeroes.
 int dischargeNegated(BitmapStorage32 container, int max)
          Write out up to max words (negated), returns how many were written
 int getLiteralWordAt(int index)
          Get the nth literal word for the current running length word
 int getNumberOfLiteralWords()
          Gets the number of literal words for the current running length word.
 boolean getRunningBit()
          Gets the running bit.
 int getRunningLength()
          Gets the running length.
 int size()
          Size in uncompressed words of the current running length word.
 void writeLiteralWords(int numWords, BitmapStorage32 container)
          write the first N literal words to the target bitmap.
 void writeNegatedLiteralWords(int numWords, BitmapStorage32 container)
          write the first N literal words (negated) to the target bitmap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratingBufferedRunningLengthWord32

public IteratingBufferedRunningLengthWord32(EWAHIterator32 iterator)
Instantiates a new iterating buffered running length word.

Parameters:
iterator - iterator

IteratingBufferedRunningLengthWord32

public IteratingBufferedRunningLengthWord32(EWAHCompressedBitmap32 bitmap)
Instantiates a new iterating buffered running length word.

Parameters:
iterator - iterator
Method Detail

discardFirstWords

public void discardFirstWords(int x)
Discard first words, iterating to the next running length word if needed.

Parameters:
x - the x

discharge

public int discharge(BitmapStorage32 container,
                     int max)
Write out up to max words, returns how many were written

Parameters:
container - target for writes
max - maximal number of writes
Returns:
how many written

dischargeNegated

public int dischargeNegated(BitmapStorage32 container,
                            int max)
Write out up to max words (negated), returns how many were written

Parameters:
container - target for writes
max - maximal number of writes
Returns:
how many written

dischargeAsEmpty

public void dischargeAsEmpty(BitmapStorage32 container)
Write out the remain words, transforming them to zeroes.

Parameters:
container - target for writes

discharge

public void discharge(BitmapStorage32 container)
Write out the remaining words

Parameters:
container - target for writes

getLiteralWordAt

public int getLiteralWordAt(int index)
Get the nth literal word for the current running length word

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.

Returns:
the number of literal words

getRunningBit

public boolean getRunningBit()
Gets the running bit.

Returns:
the running bit

getRunningLength

public int getRunningLength()
Gets the running length.

Returns:
the running length

size

public int size()
Size in uncompressed words of the current running length word.

Returns:
the int

writeLiteralWords

public void writeLiteralWords(int numWords,
                              BitmapStorage32 container)
write the first N literal words to the target bitmap. Does not discard the words or perform iteration.

Parameters:
numWords -
container -

writeNegatedLiteralWords

public void writeNegatedLiteralWords(int numWords,
                                     BitmapStorage32 container)
write the first N literal words (negated) to the target bitmap. Does not discard the words or perform iteration.

Parameters:
numWords -
container -

discharge

protected static void discharge(BufferedRunningLengthWord32 initialWord,
                                EWAHIterator32 iterator,
                                BitmapStorage32 container)
For internal use.

Parameters:
initialWord - the initial word
iterator - the iterator
container - the container


Copyright © 2013. All Rights Reserved.