Package com.googlecode.javaewah
Interface Buffer
-
- All Known Implementing Classes:
LongArray
,LongBufferWrapper
interface Buffer
Buffer interface. Users should not be concerned by this class.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
andLastWord(long mask)
Replaces the last word position in the buffer with its bitwise-and with the given mask.void
andWord(int position, long mask)
Replaces the word at the given position in the buffer with its bitwise-and with the given mask.void
clear()
Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale dataBuffer
clone()
Creates and returns a copy of the buffervoid
collapse(int position, int length)
Removes a given number of words at the given position in the buffer.void
ensureCapacity(int capacity)
Increases the size of the buffer if necessaryvoid
expand(int position, int length)
Expands the buffer by adding the given number of words at the given position.long
getLastWord()
Returns the last word of the bufferlong
getWord(int position)
Returns the word at a given positionvoid
negateWord(int position)
Negates the word at the given position in the buffervoid
negative_push_back(Buffer buffer, int start, int number)
Same as push_back, but the words are negated.void
orLastWord(long mask)
Replaces the last word position in the buffer with its bitwise-or with the given mask.void
orWord(int position, long mask)
Replaces the word at the given position in the buffer with its bitwise-or with the given mask.void
push_back(long word)
Appends the specified word to the end of the buffervoid
push_back(Buffer buffer, int start, int number)
Appends the specified buffer words to the end of the buffer.void
removeLastWord()
Removes the last word from the buffervoid
setLastWord(long word)
Replaces the last word in the buffer with the specified word.void
setWord(int position, long word)
Replaces the word at the given position in the buffer with the specified word.int
sizeInWords()
Returns the actual size in wordsvoid
swap(Buffer other)
Swap the content of the buffer with another.void
trim()
Reduces the internal buffer to its minimal allowable size.
-
-
-
Method Detail
-
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
void push_back(Buffer buffer, int start, int number)
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
void negative_push_back(Buffer buffer, int start, int number)
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
Buffer clone() throws java.lang.CloneNotSupportedException
Creates and returns a copy of the buffer- Throws:
java.lang.CloneNotSupportedException
-
swap
void swap(Buffer other)
Swap the content of the buffer with another.- Parameters:
other
- buffer to swap with
-
-