Top Description Fields Constructors Methods
com.googlecode.javaewah

public final Class IteratingBufferedRunningLengthWord

extends Object
implements IteratingRLW, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, com.googlecode.javaewah.IteratingRLW

Mostly for internal use. Similar to BufferedRunningLengthWord, but automatically advances to the next BufferedRunningLengthWord as words are discarded.
Author
David McIntosh
Since
0.4.0

Field Summary

Modifier and TypeField and Description
private BufferedRunningLengthWord
private final Buffer
private EWAHIterator
private int

Constructor Summary

AccessConstructor and Description
public
IteratingBufferedRunningLengthWord(final EWAHIterator
iterator
iterator
)

Instantiates a new iterating buffered running length word.

public
IteratingBufferedRunningLengthWord(final EWAHCompressedBitmap
over which we want to iterate
bitmap
)

Instantiates a new iterating buffered running length word.

Method Summary

Modifier and TypeMethod and Description
public IteratingBufferedRunningLengthWord
clone()

Overrides java.lang.Object.clone.

Implements com.googlecode.javaewah.IteratingRLW.clone.

Creates and returns a copy of this object.

public void
discardFirstWords(long
the number of words to be discarded
x
)

Implements com.googlecode.javaewah.IteratingRLW.discardFirstWords.

Discard first words, iterating to the next running length word if needed.

public void
discardLiteralWords(long
the number of words to discard
x
)

Implements com.googlecode.javaewah.IteratingRLW.discardLiteralWords.

Discard x literal words (assumes that there is no running word)

public void
public long

Returns:

how many written
discharge
(BitmapStorage
target for writes
container
,
long
maximal number of writes
max
)

Write out up to max words, returns how many were written

public void
discharge(BitmapStorage
target for writes
container
)

Write out the remaining words

private static void
discharge(final BufferedRunningLengthWord
the initial word
initialWord
,
final EWAHIterator
the iterator
iterator
,
final BitmapStorage
the container
container
)

For internal use.

public void
dischargeAsEmpty(BitmapStorage
target for writes
container
)

Write out the remain words, transforming them to zeroes.

public long

Returns:

how many written
dischargeNegated
(BitmapStorage
target for writes
container
,
long
maximal number of writes
max
)

Write out up to max words (negated), returns how many were written

public long

Returns:

the literal word
getLiteralWordAt
(int
zero based index
index
)

Implements com.googlecode.javaewah.IteratingRLW.getLiteralWordAt.

Get the nth literal word for the current running length word

public int

Returns:

the number of literal words
getNumberOfLiteralWords
()

Implements com.googlecode.javaewah.IteratingRLW.getNumberOfLiteralWords.

Gets the number of literal words for the current running length word.

public boolean

Returns:

the running bit
getRunningBit
()

Implements com.googlecode.javaewah.IteratingRLW.getRunningBit.

Gets the running bit.

public long

Returns:

the running length
getRunningLength
()

Implements com.googlecode.javaewah.IteratingRLW.getRunningLength.

Gets the running length.

public boolean

Returns:

whether the move was possible
next
()

Implements com.googlecode.javaewah.IteratingRLW.next.

Move to the next RunningLengthWord

public long

Returns:

the long
size
()

Implements com.googlecode.javaewah.IteratingRLW.size.

Size in uncompressed words of the current running length word.

public void
writeLiteralWords(int
number of words to be written
numWords
,
BitmapStorage
where we write
container
)

write the first N literal words to the target bitmap.

public void
writeNegatedLiteralWords(int
number of words to be written
numWords
,
BitmapStorage
where we write
container
)

write the first N literal words (negated) to the target bitmap.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

brlwback to summary
private BufferedRunningLengthWord brlw
bufferback to summary
private final Buffer buffer
iteratorback to summary
private EWAHIterator iterator
literalWordStartPositionback to summary
private int literalWordStartPosition

Constructor Detail

IteratingBufferedRunningLengthWordback to summary
public IteratingBufferedRunningLengthWord(final EWAHIterator iterator)

Instantiates a new iterating buffered running length word.

Parameters
iterator:EWAHIterator

iterator

IteratingBufferedRunningLengthWordback to summary
public IteratingBufferedRunningLengthWord(final EWAHCompressedBitmap bitmap)

Instantiates a new iterating buffered running length word.

Parameters
bitmap:EWAHCompressedBitmap

over which we want to iterate

Method Detail

cloneback to summary
public IteratingBufferedRunningLengthWord clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Implements com.googlecode.javaewah.IteratingRLW.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:IteratingBufferedRunningLengthWord

Doc from com.googlecode.javaewah.IteratingRLW.clone.

a copy of the iterator

Annotations
@Override
Exceptions
CloneNotSupportedException:

Doc from com.googlecode.javaewah.IteratingRLW.clone.

this should not be thrown in theory

discardFirstWordsback to summary
public void discardFirstWords(long x)

Implements com.googlecode.javaewah.IteratingRLW.discardFirstWords.

Discard first words, iterating to the next running length word if needed.

Parameters
x:long

the number of words to be discarded

Annotations
@Override
discardLiteralWordsback to summary
public void discardLiteralWords(long x)

Implements com.googlecode.javaewah.IteratingRLW.discardLiteralWords.

Doc from com.googlecode.javaewah.IteratingRLW.discardLiteralWords.

Discard x literal words (assumes that there is no running word)

Parameters
x:long

the number of words to discard

Annotations
@Override
discardRunningWordsback to summary
public void discardRunningWords()

Implements com.googlecode.javaewah.IteratingRLW.discardRunningWords.

Doc from com.googlecode.javaewah.IteratingRLW.discardRunningWords.

Discard all running words

Annotations
@Override
dischargeback to summary
public long discharge(BitmapStorage container, long max)

Write out up to max words, returns how many were written

Parameters
container:BitmapStorage

target for writes

max:long

maximal number of writes

Returns:long

how many written

dischargeback to summary
public void discharge(BitmapStorage container)

Write out the remaining words

Parameters
container:BitmapStorage

target for writes

dischargeback to summary
private static void discharge(final BufferedRunningLengthWord initialWord, final EWAHIterator iterator, final BitmapStorage container)

For internal use. (One could use the non-static discharge method instead, but we expect them to be slower.)

Parameters
initialWord:BufferedRunningLengthWord

the initial word

iterator:EWAHIterator

the iterator

container:BitmapStorage

the container

dischargeAsEmptyback to summary
public void dischargeAsEmpty(BitmapStorage container)

Write out the remain words, transforming them to zeroes.

Parameters
container:BitmapStorage

target for writes

dischargeNegatedback to summary
public long dischargeNegated(BitmapStorage container, long max)

Write out up to max words (negated), returns how many were written

Parameters
container:BitmapStorage

target for writes

max:long

maximal number of writes

Returns:long

how many written

getLiteralWordAtback to summary
public long getLiteralWordAt(int index)

Implements com.googlecode.javaewah.IteratingRLW.getLiteralWordAt.

Get the nth literal word for the current running length word

Parameters
index:int

zero based index

Returns:long

the literal word

Annotations
@Override
getNumberOfLiteralWordsback to summary
public int getNumberOfLiteralWords()

Implements com.googlecode.javaewah.IteratingRLW.getNumberOfLiteralWords.

Gets the number of literal words for the current running length word.

Returns:int

the number of literal words

Annotations
@Override
getRunningBitback to summary
public boolean getRunningBit()

Implements com.googlecode.javaewah.IteratingRLW.getRunningBit.

Gets the running bit.

Returns:boolean

the running bit

Annotations
@Override
getRunningLengthback to summary
public long getRunningLength()

Implements com.googlecode.javaewah.IteratingRLW.getRunningLength.

Gets the running length.

Returns:long

the running length

Annotations
@Override
nextback to summary
public boolean next()

Implements com.googlecode.javaewah.IteratingRLW.next.

Move to the next RunningLengthWord

Returns:boolean

whether the move was possible

Annotations
@Override
sizeback to summary
public long size()

Implements com.googlecode.javaewah.IteratingRLW.size.

Size in uncompressed words of the current running length word.

Returns:long

the long

Annotations
@Override
writeLiteralWordsback to summary
public void writeLiteralWords(int numWords, BitmapStorage container)

write the first N literal words to the target bitmap. Does not discard the words or perform iteration.

Parameters
numWords:int

number of words to be written

container:BitmapStorage

where we write

writeNegatedLiteralWordsback to summary
public void writeNegatedLiteralWords(int numWords, BitmapStorage container)

write the first N literal words (negated) to the target bitmap. Does not discard the words or perform iteration.

Parameters
numWords:int

number of words to be written

container:BitmapStorage

where we write