Top Description Fields Constructors Methods
com.googlecode.javaewah

pack-priv final Class LongArray

extends Object
implements Buffer, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, com.googlecode.javaewah.Buffer
Imports
java.util.Arrays

Long array wrapper. Users should not be concerned by this class.
Author
Gregory Ssi-Yan-Kai

Field Summary

Modifier and TypeField and Description
private int
actualSizeInWords

The actual size in words.

private long[]
buffer

The buffer (array of 64-bit words)

private static final int
DEFAULT_BUFFER_SIZE

The Constant DEFAULT_BUFFER_SIZE: default memory allocation when the object is constructed.

Constructor Summary

AccessConstructor and Description
public
LongArray()

Creates a buffer with default size

public
LongArray(int bufferSize)

Creates a buffer with explicit size

Method Summary

Modifier and TypeMethod and Description
public void
andLastWord(long mask)

Implements com.googlecode.javaewah.Buffer.andLastWord.

Replaces the last word position in the buffer with its bitwise-and with the given mask.

public void
andWord(int position, long mask)

Implements com.googlecode.javaewah.Buffer.andWord.

Replaces the word at the given position in the buffer with its bitwise-and with the given mask.

public void
clear()

Implements com.googlecode.javaewah.Buffer.clear.

Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale data

public LongArray
clone()

Overrides java.lang.Object.clone.

Implements com.googlecode.javaewah.Buffer.clone.

Creates and returns a copy of the buffer

public void
collapse(int
the position of the buffer where to add words
position
,
int
the number of words to add
length
)

Implements com.googlecode.javaewah.Buffer.collapse.

Removes a given number of words at the given position in the buffer.

public void
ensureCapacity(int capacity)

Implements com.googlecode.javaewah.Buffer.ensureCapacity.

Increases the size of the buffer if necessary

public void
expand(int
the position of the buffer where to add words
position
,
int
the number of words to add
length
)

Implements com.googlecode.javaewah.Buffer.expand.

Expands the buffer by adding the given number of words at the given position.

public long
getLastWord()

Implements com.googlecode.javaewah.Buffer.getLastWord.

Returns the last word of the buffer

public long
getWord(int position)

Implements com.googlecode.javaewah.Buffer.getWord.

Returns the word at a given position

public void
negateWord(int position)

Implements com.googlecode.javaewah.Buffer.negateWord.

Negates the word at the given position in the buffer

public void
negative_push_back(Buffer
the buffer
buffer
,
int
the position of the first word to add
start
,
int
the number of words to add
number
)

Implements com.googlecode.javaewah.Buffer.negative_push_back.

Same as push_back, but the words are negated.

private int
newSizeInWords(int
the number of words to add
number
)

Returns the resulting buffer size in words given the number of words to add.

public void
orLastWord(long mask)

Implements com.googlecode.javaewah.Buffer.orLastWord.

Replaces the last word position in the buffer with its bitwise-or with the given mask.

public void
orWord(int position, long mask)

Implements com.googlecode.javaewah.Buffer.orWord.

Replaces the word at the given position in the buffer with its bitwise-or with the given mask.

public void
push_back(long word)

Implements com.googlecode.javaewah.Buffer.push_back.

Appends the specified word to the end of the buffer

public void
push_back(Buffer
the buffer
buffer
,
int
the position of the first word to add
start
,
int
the number of words to add
number
)

Implements com.googlecode.javaewah.Buffer.push_back.

Appends the specified buffer words to the end of the buffer.

public void
removeLastWord()

Implements com.googlecode.javaewah.Buffer.removeLastWord.

Removes the last word from the buffer

private void
resizeBuffer(int
the number of words to add
number
)

Resizes the buffer if the number of words to add exceeds the buffer capacity.

public void
setLastWord(long word)

Implements com.googlecode.javaewah.Buffer.setLastWord.

Replaces the last word in the buffer with the specified word.

public void
setWord(int position, long word)

Implements com.googlecode.javaewah.Buffer.setWord.

Replaces the word at the given position in the buffer with the specified word.

public int
sizeInWords()

Implements com.googlecode.javaewah.Buffer.sizeInWords.

Returns the actual size in words

public void
swap(final Buffer
buffer to swap with
other
)

Implements com.googlecode.javaewah.Buffer.swap.

Swap the content of the buffer with another.

public void
trim()

Implements com.googlecode.javaewah.Buffer.trim.

Reduces the internal buffer to its minimal allowable size.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

actualSizeInWordsback to summary
private int actualSizeInWords

The actual size in words.

bufferback to summary
private long[] buffer

The buffer (array of 64-bit words)

DEFAULT_BUFFER_SIZEback to summary
private static final int DEFAULT_BUFFER_SIZE

The Constant DEFAULT_BUFFER_SIZE: default memory allocation when the object is constructed.

Constructor Detail

LongArrayback to summary
public LongArray()

Creates a buffer with default size

LongArrayback to summary
public LongArray(int bufferSize)

Creates a buffer with explicit size

Method Detail

andLastWordback to summary
public void andLastWord(long mask)

Implements com.googlecode.javaewah.Buffer.andLastWord.

Doc from com.googlecode.javaewah.Buffer.andLastWord.

Replaces the last word position in the buffer with its bitwise-and with the given mask.

Annotations
@Override
andWordback to summary
public void andWord(int position, long mask)

Implements com.googlecode.javaewah.Buffer.andWord.

Doc from com.googlecode.javaewah.Buffer.andWord.

Replaces the word at the given position in the buffer with its bitwise-and with the given mask.

Annotations
@Override
clearback to summary
public void clear()

Implements com.googlecode.javaewah.Buffer.clear.

Doc from com.googlecode.javaewah.Buffer.clear.

Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale data

Annotations
@Override
cloneback to summary
public LongArray clone()

Overrides java.lang.Object.clone.

Implements com.googlecode.javaewah.Buffer.clone.

Doc from com.googlecode.javaewah.Buffer.clone.

Creates and returns a copy of the buffer

Returns:LongArray

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
collapseback to summary
public void collapse(int position, int length)

Implements com.googlecode.javaewah.Buffer.collapse.

Doc from com.googlecode.javaewah.Buffer.collapse.

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:int

the position of the buffer where to add words

length:int

the number of words to add

Annotations
@Override
ensureCapacityback to summary
public void ensureCapacity(int capacity)

Implements com.googlecode.javaewah.Buffer.ensureCapacity.

Doc from com.googlecode.javaewah.Buffer.ensureCapacity.

Increases the size of the buffer if necessary

Annotations
@Override
expandback to summary
public void expand(int position, int length)

Implements com.googlecode.javaewah.Buffer.expand.

Doc from com.googlecode.javaewah.Buffer.expand.

Expands the buffer by adding the given number of words at the given position. The added words may contain stale data.

Parameters
position:int

the position of the buffer where to add words

length:int

the number of words to add

Annotations
@Override
getLastWordback to summary
public long getLastWord()

Implements com.googlecode.javaewah.Buffer.getLastWord.

Doc from com.googlecode.javaewah.Buffer.getLastWord.

Returns the last word of the buffer

Returns:long

the last word

Annotations
@Override
getWordback to summary
public long getWord(int position)

Implements com.googlecode.javaewah.Buffer.getWord.

Doc from com.googlecode.javaewah.Buffer.getWord.

Returns the word at a given position

Returns:long

the word

Annotations
@Override
negateWordback to summary
public void negateWord(int position)

Implements com.googlecode.javaewah.Buffer.negateWord.

Doc from com.googlecode.javaewah.Buffer.negateWord.

Negates the word at the given position in the buffer

Annotations
@Override
negative_push_backback to summary
public void negative_push_back(Buffer buffer, int start, int number)

Implements com.googlecode.javaewah.Buffer.negative_push_back.

Doc from com.googlecode.javaewah.Buffer.negative_push_back.

Same as push_back, but the words are negated.

Parameters
buffer:Buffer

the buffer

start:int

the position of the first word to add

number:int

the number of words to add

Annotations
@Override
newSizeInWordsback to summary
private int newSizeInWords(int number)

Returns the resulting buffer size in words given the number of words to add.

Parameters
number:int

the number of words to add

orLastWordback to summary
public void orLastWord(long mask)

Implements com.googlecode.javaewah.Buffer.orLastWord.

Doc from com.googlecode.javaewah.Buffer.orLastWord.

Replaces the last word position in the buffer with its bitwise-or with the given mask.

Annotations
@Override
orWordback to summary
public void orWord(int position, long mask)

Implements com.googlecode.javaewah.Buffer.orWord.

Doc from com.googlecode.javaewah.Buffer.orWord.

Replaces the word at the given position in the buffer with its bitwise-or with the given mask.

Annotations
@Override
push_backback to summary
public void push_back(long word)

Implements com.googlecode.javaewah.Buffer.push_back.

Doc from com.googlecode.javaewah.Buffer.push_back.

Appends the specified word to the end of the buffer

Annotations
@Override
push_backback to summary
public void push_back(Buffer buffer, int start, int number)

Implements com.googlecode.javaewah.Buffer.push_back.

Doc from com.googlecode.javaewah.Buffer.push_back.

Appends the specified buffer words to the end of the buffer.

Parameters
buffer:Buffer

the buffer

start:int

the position of the first word to add

number:int

the number of words to add

Annotations
@Override
removeLastWordback to summary
public void removeLastWord()

Implements com.googlecode.javaewah.Buffer.removeLastWord.

Doc from com.googlecode.javaewah.Buffer.removeLastWord.

Removes the last word from the buffer

Annotations
@Override
resizeBufferback to summary
private void resizeBuffer(int number)

Resizes the buffer if the number of words to add exceeds the buffer capacity.

Parameters
number:int

the number of words to add

setLastWordback to summary
public void setLastWord(long word)

Implements com.googlecode.javaewah.Buffer.setLastWord.

Doc from com.googlecode.javaewah.Buffer.setLastWord.

Replaces the last word in the buffer with the specified word.

Annotations
@Override
setWordback to summary
public void setWord(int position, long word)

Implements com.googlecode.javaewah.Buffer.setWord.

Doc from com.googlecode.javaewah.Buffer.setWord.

Replaces the word at the given position in the buffer with the specified word.

Annotations
@Override
sizeInWordsback to summary
public int sizeInWords()

Implements com.googlecode.javaewah.Buffer.sizeInWords.

Doc from com.googlecode.javaewah.Buffer.sizeInWords.

Returns the actual size in words

Annotations
@Override
swapback to summary
public void swap(final Buffer other)

Implements com.googlecode.javaewah.Buffer.swap.

Doc from com.googlecode.javaewah.Buffer.swap.

Swap the content of the buffer with another.

Parameters
other:Buffer

buffer to swap with

Annotations
@Override
trimback to summary
public void trim()

Implements com.googlecode.javaewah.Buffer.trim.

Doc from com.googlecode.javaewah.Buffer.trim.

Reduces the internal buffer to its minimal allowable size. This can free memory.

Annotations
@Override