public final class BitMatrix1D extends Object
longs.| Constructor and Description |
|---|
BitMatrix1D(long size)
Create a new 1D bit matrix of the specified size.
|
| Modifier and Type | Method and Description |
|---|---|
BitMatrix1D |
and(BitMatrix1D other)
Perform a logical AND of this 1D bit matrix
and the specified 1D bit matrix.
|
BitMatrix1D |
andNot(BitMatrix1D other)
Clear all of the bits in this 1D bit matrix whose corresponding
bit is set in the specified 1D bit matrix.
|
BitMatrix1D |
assign(boolean value)
Assign all values in this 1D bit matrix to
value. |
long |
cardinality()
Return the cardinality of this 1D bit matrix, the
number of bits set to true.
|
void |
clear()
Clear all the values in this 1D bit matrix.
|
boolean |
equals(Object o) |
void |
flip(long index)
Set the bit value at the specified index to the complement
of its current bit value.
|
void |
flip(long index0,
long index1)
Set all of the bit values from
index0, inclusive, to
index1, exclusive, to the complement of their current
bit values. |
void |
flipQuick(long index)
Set the bit value at the specified index to the complement
of its current bit value without checking bounds.
|
void |
forEach(boolean value,
UnaryProcedure<Long> procedure)
Apply the specified procedure to each index in this 1D bit
matrix with a bit equal to the specified value.
|
boolean |
get(long index)
Return the bit value at the specified index.
|
boolean |
getQuick(long index)
Return the bit value at the specified index without checking bounds.
|
int |
hashCode() |
boolean |
intersects(BitMatrix1D other)
Return true if the specified 1D bit matrix has any bits set
to true that are also set to true in this 1D bit matrix.
|
boolean |
isEmpty()
Return true if the cardinality of this 1D bit matrix is zero.
|
BitMatrix1D |
or(BitMatrix1D other)
Perform a logical OR of this 1D bit matrix
and the specified 1D bit matrix.
|
void |
set(long index,
boolean value)
Set the bit value at the specified index to
value. |
void |
set(long index0,
long index1,
boolean value)
Set all of the bit values from
index0, inclusive, to
index1, exclusive, to the specified value. |
void |
setQuick(long index,
boolean value)
Set the bit value at the specified index to
value without checking bounds. |
long |
size()
Return the size of this 1D bit matrix.
|
BitMatrix1D |
xor(BitMatrix1D other)
Perform a logical XOR of this 1D bit matrix
and the specified 1D bit matrix.
|
public BitMatrix1D(long size)
size - size, must be >= 0IllegalArgumentException - if size is negativepublic long size()
public long cardinality()
public boolean isEmpty()
public void clear()
public boolean get(long index)
index - index, must be >= 0 and < size()IndexOutOfBoundsException - if index is negative
or if index is greater than or equal to size()public boolean getQuick(long index)
index - indexpublic void set(long index,
boolean value)
value.index - index, must be >= 0 and < size()value - valueIndexOutOfBoundsException - if index is negative
or if index is greater than or equal to size()public void setQuick(long index,
boolean value)
value without checking bounds.index - indexvalue - valuepublic void set(long index0,
long index1,
boolean value)
index0, inclusive, to
index1, exclusive, to the specified value.index0 - first index, must be >= 0 and < size()index1 - second index, must be >= 0, <= size()
and >= index0value - valueIllegalArgumentException - if index1 is less than index0IndexOutOfBoundsException - if either index0
or index1 are negative or if index0 is greater than
or equal to size() or if index1 is strictly greater
than size()public void flip(long index)
index - index, must be >= 0 and < size()IndexOutOfBoundsException - if index is negative
or if index is greater than or equal to size()public void flipQuick(long index)
index - indexpublic void flip(long index0,
long index1)
index0, inclusive, to
index1, exclusive, to the complement of their current
bit values.index0 - first index, must be >= 0 and < size()index1 - second index, must be >= 0, <= size()
and >= index0IllegalArgumentException - if index1 is less than index0IndexOutOfBoundsException - if either index0
or index1 are negative or if index0 is greater than
or equal to size() or if index1 is strictly greater
than size()public BitMatrix1D assign(boolean value)
value.value - valuepublic boolean intersects(BitMatrix1D other)
other - other 1D bit matrix, must not be null and must
be the same size as this 1D bit matrixIllegalArgumentException - if other is null
or if other is not the same size as thispublic BitMatrix1D and(BitMatrix1D other)
other - other 1D bit matrix, must not be null and must
be the same size as this 1D bit matrixIllegalArgumentException - if other is null
or if other is not the same size as thispublic BitMatrix1D andNot(BitMatrix1D other)
other - other 1D bit matrix, must not be null and must
be the same size as this 1D bit matrixIllegalArgumentException - if other is null
or if other is not the same size as thispublic BitMatrix1D or(BitMatrix1D other)
other - other 1D bit matrix, must not be null and must
be the same size as this 1D bit matrixIllegalArgumentException - if other is null
or if other is not the same size as thispublic BitMatrix1D xor(BitMatrix1D other)
other - other 1D bit matrix, must not be null and must
be the same size as this 1D bit matrixIllegalArgumentException - if other is null
or if other is not the same size as thispublic void forEach(boolean value,
UnaryProcedure<Long> procedure)
value - valueprocedure - procedure, must not be nullCopyright (c) 2004-2013 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).