Interface Buffer
- All Known Implementing Classes:
LongArray, LongBufferWrapper
interface Buffer
Buffer interface.
Users should not be concerned by this class.
-
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.
-
Method Details
-
sizeInWords
int sizeInWords()Returns the actual size in words -
ensureCapacity
void ensureCapacity(int capacity) Increases the size of the buffer if necessary -
getWord
long getWord(int position) Returns the word at a given position- Parameters:
position-- Returns:
- the word
-
getLastWord
long getLastWord()Returns the last word of the buffer- Returns:
- the last word
-
clear
void clear()Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale data -
trim
void trim()Reduces the internal buffer to its minimal allowable size. This can free memory. -
setWord
void setWord(int position, long word) Replaces the word at the given position in the buffer with the specified word.- Parameters:
position-word-
-
setLastWord
void setLastWord(long word) Replaces the last word in the buffer with the specified word.- Parameters:
word-
-
push_back
void push_back(long word) Appends the specified word to the end of the buffer- Parameters:
word-
-
push_back
Appends the specified buffer words to the end of the buffer.- Parameters:
buffer- the bufferstart- the position of the first word to addnumber- the number of words to add
-
negative_push_back
Same as push_back, but the words are negated.- Parameters:
buffer- the bufferstart- the position of the first word to addnumber- the number of words to add
-
removeLastWord
void removeLastWord()Removes the last word from the buffer -
negateWord
void negateWord(int position) Negates the word at the given position in the buffer- Parameters:
position-
-
andWord
void andWord(int position, long mask) Replaces the word at the given position in the buffer with its bitwise-and with the given mask.- Parameters:
position-mask-
-
orWord
void orWord(int position, long mask) Replaces the word at the given position in the buffer with its bitwise-or with the given mask.- Parameters:
position-mask-
-
andLastWord
void andLastWord(long mask) Replaces the last word position in the buffer with its bitwise-and with the given mask.- Parameters:
mask-
-
orLastWord
void orLastWord(long mask) Replaces the last word position in the buffer with its bitwise-or with the given mask.- Parameters:
mask-
-
expand
void expand(int position, int length) Expands the buffer by adding the given number of words at the given position. The added words may contain stale data.- Parameters:
position- the position of the buffer where to add wordslength- the number of words to add
-
collapse
void collapse(int position, int length) Removes a given number of words at the given position in the buffer. The freed words at the end of the buffer are properly cleaned.- Parameters:
position- the position of the buffer where to add wordslength- the number of words to add
-
clone
Creates and returns a copy of the buffer- Throws:
CloneNotSupportedException
-
swap
Swap the content of the buffer with another.- Parameters:
other- buffer to swap with
-