public interface BitVector extends Comparable<BitVector>
equals(java.lang.Object), hashCode(), copyFromSection(BitVector, int), copySectionFrom(int, com.google.uzaygezen.core.BitVector) and grayCodeRank(com.google.uzaygezen.core.BitVector, com.google.uzaygezen.core.BitVector), all other methods accepting a BitVector parameter
fail if the bit vector parameter has a different 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) |
BitVector |
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 data)
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 o)
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 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 set) |
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
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 {
toLong() can return a negative long, {toBigInteger()
always produces a nonnegative value. |
BitSet |
toBitSet()
Returns a non-shared bit set representing the same set of bits.
|
long |
toExactLong()
Like
toLong(), but fails if the number doesn't fit in 64 bits. |
long |
toLong() |
long[] |
toLongArray()
See
BitSet#toLongArray in Java 7. |
void |
xor(BitVector o) |
boolean isEmpty()
void set(int bitIndex)
void set(int bitIndex,
boolean value)
void set(int fromIndex,
int toIndex)
void set(int fromIndex,
int toIndex,
boolean value)
boolean get(int bitIndex)
void copyFromSection(BitVector src, int fromIndex)
IllegalArgumentException - if src.size() < fromIndex + size()void copySectionFrom(int offset,
BitVector src)
src.size() bits from src into this bit vector, starting
with position offset.IllegalArgumentException - if offset + src.size() > size()int length()
int size()
void clear()
void clear(int bitIndex)
void clear(int fromIndex,
int toIndex)
int cardinality()
void flip(int bitIndex)
void flip(int fromIndex,
int toIndex)
boolean intersects(BitVector set)
int nextSetBit(int fromIndex)
true
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.int nextClearBit(int fromIndex)
true
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).boolean increment()
false then the value is incremented by one
and true is returned; otherwise false is returned.void andNot(BitVector o)
void and(BitVector o)
void or(BitVector o)
BitVectoro - A BitVector, sizes must be equal.void xor(BitVector o)
void rotate(int count)
count bits to the right.count - can be negativevoid grayCode()
void grayCodeInverse()
void smallerEvenAndGrayCode()
int lowestDifferentBit()
size();result == 0 || (0 < result & result < size)boolean areAllLowestBitsClear(int bitCount)
true if the lowest bitCount bits are clear;
false otherwise. If called with the parameter bitCount = 0
it will always return true.void grayCodeRank(BitVector mu, BitVector w)
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. This method
computes the rank of that number in the sorted list.mu - 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.IllegalArgumentException - if mu.size() != w.size()
|| size() != mu.cardinality()void grayCodeRankInverse(BitVector mu, BitVector known, BitVector r)
i to the bit set represented by this, this
method computes the inverse function for 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 grayCode() can be called with this method's output (i.e., this) as input.mu - pattern of free bitsknown - the known bits from i's gray coder - gray code rank of this with respect to muvoid copyFrom(BitVector from)
void copyFrom(BitSet from)
IllegalArgumentException - iff from.length() > size()BitVector clone()
BitSet toBitSet()
long toLong()
long toExactLong()
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.void copyFrom(long data)
long.long[] toLongArray()
BitSet#toLongArray in Java 7. The main difference is that we
do not stop at the highest set bit.byte[] toBigEndianByteArray()
BigInteger toBigInteger()
toLong() can return a negative long, {toBigInteger()
always produces a nonnegative value.void copyFrom(long[] array)
array - must have length (size() + 63) / 64void copyFromBigEndian(byte[] array)
array - must have length (size() + 7) / 8void copyFrom(BigInteger s)
int hashCode()
boolean equals(Object o)
int compareTo(BitVector o)
toBigInteger().compareTo(o.toBigInteger()).compareTo in interface Comparable<BitVector>IllegalArgumentException - when size() != o.size()Copyright © 2014. All Rights Reserved.