Package com.googlecode.javaewah
Class LongBufferWrapper
java.lang.Object
com.googlecode.javaewah.LongBufferWrapper
java.nio.LongBuffer wrapper.
Users should not be concerned by this class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe actual size in words.private LongBufferThe buffer -
Constructor Summary
ConstructorsConstructorDescriptionLongBufferWrapper(LongBuffer buffer) LongBufferWrapper(LongBuffer slice, int sizeInWords) -
Method Summary
Modifier and TypeMethodDescriptionvoidandLastWord(long mask) Replaces the last word position in the buffer with its bitwise-and with the given mask.voidandWord(int position, long mask) Replaces the word at the given position in the buffer with its bitwise-and with the given mask.voidclear()Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale dataclone()Creates and returns a copy of the buffervoidcollapse(int position, int length) Removes a given number of words at the given position in the buffer.voidensureCapacity(int capacity) Increases the size of the buffer if necessaryvoidexpand(int position, int length) Expands the buffer by adding the given number of words at the given position.longReturns the last word of the bufferlonggetWord(int position) Returns the word at a given positionvoidnegateWord(int position) Negates the word at the given position in the buffervoidnegative_push_back(Buffer buffer, int start, int number) Same as push_back, but the words are negated.voidorLastWord(long mask) Replaces the last word position in the buffer with its bitwise-or with the given mask.voidorWord(int position, long mask) Replaces the word at the given position in the buffer with its bitwise-or with the given mask.voidpush_back(long word) Appends the specified word to the end of the buffervoidAppends the specified buffer words to the end of the buffer.voidRemoves the last word from the buffervoidsetLastWord(long word) Replaces the last word in the buffer with the specified word.voidsetWord(int position, long word) Replaces the word at the given position in the buffer with the specified word.intReturns the actual size in wordsvoidSwap the content of the buffer with another.voidtrim()Reduces the internal buffer to its minimal allowable size.
-
Field Details
-
actualSizeInWords
private int actualSizeInWordsThe actual size in words. -
buffer
The buffer
-
-
Constructor Details
-
LongBufferWrapper
-
LongBufferWrapper
-
-
Method Details
-
sizeInWords
public int sizeInWords()Description copied from interface:BufferReturns the actual size in words- Specified by:
sizeInWordsin interfaceBuffer
-
ensureCapacity
public void ensureCapacity(int capacity) Description copied from interface:BufferIncreases the size of the buffer if necessary- Specified by:
ensureCapacityin interfaceBuffer
-
getWord
public long getWord(int position) Description copied from interface:BufferReturns the word at a given position -
getLastWord
public long getLastWord()Description copied from interface:BufferReturns the last word of the buffer- Specified by:
getLastWordin interfaceBuffer- Returns:
- the last word
-
clear
public void clear()Description copied from interface:BufferResets the buffer The buffer is not fully cleared and any new set operations should overwrite stale data -
trim
public void trim()Description copied from interface:BufferReduces the internal buffer to its minimal allowable size. This can free memory. -
setWord
public void setWord(int position, long word) Description copied from interface:BufferReplaces the word at the given position in the buffer with the specified word. -
setLastWord
public void setLastWord(long word) Description copied from interface:BufferReplaces the last word in the buffer with the specified word.- Specified by:
setLastWordin interfaceBuffer- Parameters:
word-
-
push_back
public void push_back(long word) Description copied from interface:BufferAppends the specified word to the end of the buffer -
push_back
Description copied from interface:BufferAppends the specified buffer words to the end of the buffer. -
negative_push_back
Description copied from interface:BufferSame as push_back, but the words are negated.- Specified by:
negative_push_backin interfaceBuffer- Parameters:
buffer- the bufferstart- the position of the first word to addnumber- the number of words to add
-
removeLastWord
public void removeLastWord()Description copied from interface:BufferRemoves the last word from the buffer- Specified by:
removeLastWordin interfaceBuffer
-
negateWord
public void negateWord(int position) Description copied from interface:BufferNegates the word at the given position in the buffer- Specified by:
negateWordin interfaceBuffer- Parameters:
position-
-
andWord
public void andWord(int position, long mask) Description copied from interface:BufferReplaces the word at the given position in the buffer with its bitwise-and with the given mask. -
orWord
public void orWord(int position, long mask) Description copied from interface:BufferReplaces the word at the given position in the buffer with its bitwise-or with the given mask. -
andLastWord
public void andLastWord(long mask) Description copied from interface:BufferReplaces the last word position in the buffer with its bitwise-and with the given mask.- Specified by:
andLastWordin interfaceBuffer- Parameters:
mask-
-
orLastWord
public void orLastWord(long mask) Description copied from interface:BufferReplaces the last word position in the buffer with its bitwise-or with the given mask.- Specified by:
orLastWordin interfaceBuffer- Parameters:
mask-
-
expand
public void expand(int position, int length) Description copied from interface:BufferExpands the buffer by adding the given number of words at the given position. The added words may contain stale data. -
collapse
public void collapse(int position, int length) Description copied from interface:BufferRemoves a given number of words at the given position in the buffer. The freed words at the end of the buffer are properly cleaned. -
clone
Description copied from interface:BufferCreates and returns a copy of the buffer- Specified by:
clonein interfaceBuffer- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
swap
Description copied from interface:BufferSwap the content of the buffer with another.
-