| Constructor and Description |
|---|
LongBitVector(int size) |
| Modifier and Type | Method and Description |
|---|---|
void |
and(BitVector o) |
void |
andNot(BitVector o) |
boolean |
areAllLowestBitsClear(int bitCount) |
int |
cardinality() |
void |
clear()
Makes BitVector contain all zeros.
|
void |
clear(int bitIndex) |
void |
clear(int fromIndex,
int toIndex) |
LongBitVector |
clone() |
int |
compareTo(BitVector o)
Compares the unsigned numbers having the pattern in this and the other bit
vectors, respectively, as the little endian representation.
|
void |
copyFrom(BigInteger s) |
void |
copyFrom(BitSet from)
Makes this BitVector equal to the given bit set.
|
void |
copyFrom(BitVector from)
Makes this BitVector equal to the other bit vector.
|
void |
copyFrom(long value)
Initialises this bit vector with the little endian representation of a
long. |
void |
copyFrom(long[] array)
Makes this bit vector have the same bit pattern as the little-endian
long array, size permitting.
|
void |
copyFromBigEndian(byte[] array)
Makes this bit vector have the same bit pattern as the little-endian
long array, size permitting.
|
void |
copyFromSection(BitVector src,
int fromIndex)
|
void |
copySectionFrom(int offset,
BitVector src)
Copies all
src.size() bits from src into this bit vector, starting
with position offset. |
boolean |
equals(Object obj)
Two bit vectors are deemed iff they have the same size and they represent
the same bit pattern.
|
void |
flip(int bitIndex) |
void |
flip(int fromIndex,
int toIndex) |
boolean |
get(int bitIndex) |
void |
grayCode()
Encodes the content of bitVector as Gray code.
|
void |
grayCodeInverse()
Decodes the content of bitVector from Gray code to natural binary code.
|
void |
grayCodeRank(BitVector mu,
BitVector w)
If one puts all the numbers which have the gray code inverse fixed in all
bit positions which are zero in
mu, and they are equal in
those bit positions to the corresponding bits in w, and sorts
all those numbers increasingly, then there will be exactly one such number
that has the gray code inverse exactly equal to w. |
void |
grayCodeRankInverse(BitVector mu,
BitVector known,
BitVector r)
Giving the name
i to the bit set represented by this, this
method computes the inverse function for BitVector.grayCodeRank(com.google.uzaygezen.core.BitVector, com.google.uzaygezen.core.BitVector). |
int |
hashCode() |
boolean |
increment()
If at least one bit is
false then the value is incremented by one
and true is returned; otherwise false is returned. |
boolean |
intersects(BitVector o) |
boolean |
isEmpty() |
int |
length() |
int |
lowestDifferentBit()
Computes the length of the contiguous range of equal bits, starting from
bit zero, with the mention that all zeroes and all ones produce zero
instead of
BitVector.size(); |
int |
nextClearBit(int fromIndex)
Returns the index of the first bit that is set to
true
that occurs on or after the specified starting index. |
int |
nextSetBit(int fromIndex)
Returns the index of the first bit that is set to
true
that occurs on or after the specified starting index. |
void |
or(BitVector o)
Bitwise or with given
BitVector |
void |
rotate(int count)
Rotates by
count bits to the right. |
void |
set(int bitIndex) |
void |
set(int bitIndex,
boolean value) |
void |
set(int fromIndex,
int toIndex) |
void |
set(int fromIndex,
int toIndex,
boolean value) |
int |
size() |
void |
smallerEvenAndGrayCode()
If empty, the are no changes.
|
byte[] |
toBigEndianByteArray() |
BigInteger |
toBigInteger()
While {
BitVector.toLong() can return a negative long, {BitVector.toBigInteger()
always produces a nonnegative value. |
BitSet |
toBitSet()
Returns a non-shared bit set representing the same set of bits.
|
long |
toExactLong()
Like
BitVector.toLong(), but fails if the number doesn't fit in 64 bits. |
long |
toLong() |
long[] |
toLongArray()
See
BitSet#toLongArray in Java 7. |
String |
toString() |
void |
xor(BitVector o) |
public int cardinality()
cardinality in interface BitVectorpublic void clear()
BitVectorpublic void copyFrom(BitVector from)
BitVectorcopyFrom in interface BitVectorfor copying bits between bit vectors of
different sizespublic void grayCode()
BitVectorpublic void grayCodeInverse()
BitVectorgrayCodeInverse in interface BitVectorpublic boolean increment()
BitVectorfalse then the value is incremented by one
and true is returned; otherwise false is returned.public boolean intersects(BitVector o)
intersects in interface BitVectorpublic int nextClearBit(int fromIndex)
BitVectortrue
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned. Note that the behaviour is different from
the one exhibited by BitSet.nextClearBit(int).nextClearBit in interface BitVectorpublic int nextSetBit(int fromIndex)
BitVectortrue
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.nextSetBit in interface BitVectorpublic void or(BitVector o)
BitVectorBitVectorpublic void rotate(int count)
BitVectorcount bits to the right.public void set(int fromIndex,
int toIndex,
boolean value)
public LongBitVector clone()
public boolean equals(Object obj)
BitVectorpublic int hashCode()
public BitSet toBitSet()
BitVectorpublic long toLong()
public BigInteger toBigInteger()
BitVectorBitVector.toLong() can return a negative long, {BitVector.toBigInteger()
always produces a nonnegative value.toBigInteger in interface BitVectorpublic void copyFrom(long value)
BitVectorlong.public int compareTo(BitVector o)
BitVectortoBigInteger().compareTo(o.toBigInteger()).compareTo in interface BitVectorcompareTo in interface Comparable<BitVector>public void copyFrom(BitSet from)
BitVectorpublic void copyFromSection(BitVector src, int fromIndex)
BitVectorcopyFromSection in interface BitVectorpublic long toExactLong()
BitVectorBitVector.toLong(), but fails if the number doesn't fit in 64 bits. Even
bit vectors of size greater than 64 can succeed, if they happen not to have
any bits set at position 64 and beyond.toExactLong in interface BitVectorpublic void smallerEvenAndGrayCode()
BitVectorsmallerEvenAndGrayCode in interface BitVectorpublic void grayCodeRank(BitVector mu, BitVector w)
BitVectormu, and they are equal in
those bit positions to the corresponding bits in w, and sorts
all those numbers increasingly, then there will be exactly one such number
that has the gray code inverse exactly equal to w. This method
computes the rank of that number in the sorted list.grayCodeRank in interface BitVectormu - pattern of free bitsw - some gray code inverse. Note that every non-negative number is
the gray code inverse of exactly one number, so w can be any
number.public int lowestDifferentBit()
BitVectorBitVector.size();lowestDifferentBit in interface BitVectorresult == 0 || (0 < result & result < size)public void grayCodeRankInverse(BitVector mu, BitVector known, BitVector r)
BitVectori to the bit set represented by this, this
method computes the inverse function for BitVector.grayCodeRank(com.google.uzaygezen.core.BitVector, com.google.uzaygezen.core.BitVector). By knowing
the non-free bits of i's gray code known and the rank of
this (as a gray code inverse), both with respect to a pattern
mu, this method computes the complete number i. If the gray
code of i needs to be found out as well, then BitVector.grayCode() can be called with this method's output (i.e., this) as input.grayCodeRankInverse in interface BitVectormu - pattern of free bitsknown - the known bits from i's gray coder - gray code rank of this with respect to mupublic void copySectionFrom(int offset,
BitVector src)
BitVectorsrc.size() bits from src into this bit vector, starting
with position offset.copySectionFrom in interface BitVectorpublic long[] toLongArray()
BitVectorBitSet#toLongArray in Java 7. The main difference is that we
do not stop at the highest set bit.toLongArray in interface BitVectorpublic byte[] toBigEndianByteArray()
toBigEndianByteArray in interface BitVectorpublic void copyFrom(long[] array)
BitVectorpublic void copyFromBigEndian(byte[] array)
BitVectorcopyFromBigEndian in interface BitVectorarray - must have length (size() + 7) / 8public boolean areAllLowestBitsClear(int bitCount)
areAllLowestBitsClear in interface BitVectortrue if the lowest bitCount bits are clear;
false otherwise. If called with the parameter bitCount = 0
it will always return true.public void copyFrom(BigInteger s)
Copyright © 2014. All Rights Reserved.