Modifier and Type | Field and Description |
---|---|
static int |
BITS_PER_BYTE |
static int |
BYTES_PER_WORD |
Constructor and Description |
---|
BitVector(int width,
long count) |
Modifier and Type | Method and Description |
---|---|
int |
byteCount() |
BitVector |
clone()
Creates a deep copy of this vector.
|
void |
fill(long value)
Fills this bit vector with the specified bit value.
|
long |
getRegister(long registerIndex) |
void |
getRegisterContents(IWordSerializer serializer)
Serializes the registers of the vector using the specified serializer.
|
LongIterator |
registerIterator() |
int |
registerWidth() |
boolean |
setMaxRegister(long registerIndex,
long value)
Sets the value of the specified index register if and only if the specified
value is greater than the current value in the register.
|
void |
setRegister(long registerIndex,
long value) |
int |
wordCount() |
long[] |
words() |
public static final int BITS_PER_BYTE
public static final int BYTES_PER_WORD
public BitVector(int width, long count)
width
- the width of each register. This cannot be negative or
zero or greater than 63 (the signed word size).count
- the number of registers. This cannot be negative or zeropublic final long[] words()
public final int wordCount()
public final int byteCount()
public final int registerWidth()
public long getRegister(long registerIndex)
registerIndex
- the index of the register whose value is to be
retrieved. This cannot be negative.setRegister(long, long)
,
setMaxRegister(long, long)
public void setRegister(long registerIndex, long value)
registerIndex
- the index of the register whose value is to be set.
This cannot be negativevalue
- the value to set in the registergetRegister(long)
,
setMaxRegister(long, long)
public LongIterator registerIterator()
LongIterator
for iterating starting at the register
with index zero. This will never be null
.public boolean setMaxRegister(long registerIndex, long value)
vector.setRegister(index, Math.max(vector.getRegister(index), value));
registerIndex
- the index of the register whose value is to be set.
This cannot be negativevalue
- the value to set in the register if and only if this value
is greater than the current value in the registertrue
if and only if the specified value is greater
than or equal to the current register value. false
otherwise.getRegister(long)
,
setRegister(long, long)
,
Math.max(long, long)
public void fill(long value)
0
.value
- the value to set all bits to (only the lowest bit is used)public void getRegisterContents(IWordSerializer serializer)
serializer
- the serializer to use. This cannot be null
.public BitVector clone()
clone
in class Object
Object.clone()
Copyright © 2017. All rights reserved.