edu.berkeley.nlp.lm.array
Class CustomWidthArray
java.lang.Object
edu.berkeley.nlp.lm.array.CustomWidthArray
- All Implemented Interfaces:
- Serializable
public final class CustomWidthArray
- extends Object
- implements Serializable
An array with a custom word "width" in bits. Borrows heavily from Sux4J
(http://sux.dsi.unimi.it/)
- Author:
- adampauls
- See Also:
- Serialized Form
Method Summary |
boolean |
add(long value)
|
boolean |
addWithFixedCapacity(long value)
|
void |
clear(long index)
|
void |
ensureCapacity(long numWords)
|
void |
fill(long l,
long n)
|
long |
get(long index)
|
long |
get(long index,
int offset,
int width)
|
boolean |
getBit(long index)
|
int |
getFullWidth()
|
int |
getKeyWidth()
|
void |
incrementCount(long index,
long count)
|
long |
linearSearch(long key,
long rangeStart,
long rangeEnd,
long startIndex,
long emptyKey,
boolean returnFirstEmptyIndex)
|
static int |
numBitsNeeded(long n)
|
void |
set(long index,
long value)
|
void |
set(long index,
long value,
int offset,
int width)
|
void |
setAndGrowIfNeeded(long pos,
long value)
|
void |
setAndGrowIfNeeded(long pos,
long value,
int offset,
int width)
|
long |
size()
|
void |
trim()
|
void |
trimToSize(long sizeHere)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CustomWidthArray
public CustomWidthArray(long numWords,
int keyWidth)
CustomWidthArray
public CustomWidthArray(long numWords,
int keyWidth,
int fullWidth)
getKeyWidth
public int getKeyWidth()
ensureCapacity
public void ensureCapacity(long numWords)
trim
public void trim()
trimToSize
public void trimToSize(long sizeHere)
- Parameters:
sizeHere
-
getBit
public boolean getBit(long index)
clear
public void clear(long index)
add
public boolean add(long value)
addWithFixedCapacity
public boolean addWithFixedCapacity(long value)
get
public long get(long index)
get
public long get(long index,
int offset,
int width)
numBitsNeeded
public static int numBitsNeeded(long n)
set
public void set(long index,
long value)
set
public void set(long index,
long value,
int offset,
int width)
setAndGrowIfNeeded
public void setAndGrowIfNeeded(long pos,
long value)
setAndGrowIfNeeded
public void setAndGrowIfNeeded(long pos,
long value,
int offset,
int width)
size
public long size()
fill
public void fill(long l,
long n)
linearSearch
public long linearSearch(long key,
long rangeStart,
long rangeEnd,
long startIndex,
long emptyKey,
boolean returnFirstEmptyIndex)
incrementCount
public void incrementCount(long index,
long count)
getFullWidth
public int getFullWidth()