| java.lang.Object mlsub.typing.lowlevel.BitVector
All known Subclasses: mlsub.typing.lowlevel.Domain,
BitVector | public class BitVector implements java.io.Serializable(Code) | | Same as java.util.BitSet, without the synchronization stuff
plus additional features.
See Also: java.util.BitSet version: $Revision: 1.13 $, $Date: 2005/03/30 23:08:11 $ author: Alexandre Frey author: Daniel Bonniot author: (replaced the underlying java.util.Vector by an array author: for efficiency reasons; author: most bitvectors are less than 64 elements, so using a long often avoids author: allocating the array) |
Constructor Summary | |
public | BitVector() Creates an empty set. | public | BitVector(int nbits) Creates an empty set with the specified size. | public | BitVector(BitVector old) Creates a copy of a BitVector. |
Method Summary | |
final public void | addProduct(BitMatrix M, BitVector v) add to this the product of M by v, that is the BitVector v' such that v' =
union of all M.getRow(i) such that v.get(i) is true. | final public void | and(BitVector set) Logically ANDs this bit set with the specified set of bits. | final public void | andNot(BitVector set) | final public void | andNot(int from, BitVector set) | final public void | andNotAnd(BitVector set1, BitVector set2) | final public void | andNotAndOr(BitVector S1, BitVector S2, BitVector S3) Do this = this & (~(S1 & S2) | S3)
i.e. | final public void | andNotOr(int from, BitVector set1, BitVector set2) | final public void | andNotOr(BitVector set1, BitVector set2) | final public void | bitCopy(int src, int dest) | final public int | bitCount() Computes the number of bits set in this BitVector. | final public int | bitCount(int n) | final public void | bitMerge(int src, int dest) Merge bit src and bit dest, put the result in bit dest. | final public void | clear(int bit) Clears a bit. | final public void | clearAll() | final public boolean | equals(Object obj) Compares this object against the specified object. | final public void | fill(int n) | final public void | fillNot(int n) | final public boolean | get(int bit) Gets a bit. | final public int | getLowestClearedBit() | final public int | getLowestSetBit() Compute the first bit set in this BitVector or UNDEFINED_INDEX if this
set is empty. | final public int | getLowestSetBit(int pos) | final public int | getLowestSetBitAnd(BitVector set) | final public int | getLowestSetBitAndNotIn(BitVector set, BitVector exclude) | final public int | getLowestSetBitNotIn(BitVector set) Compute the first bit set in this & ~set. | public int | getNextBit(int i) | final public int | hashCode() Gets the hashcode. | final public boolean | includedIn(BitVector set) | public boolean | isEmpty() | final public void | or(BitVector set) | final public void | orAnd(BitVector set1, BitVector set2) | final public void | orNotIn(BitVector set1, BitVector set2) | public void | set(int bit) Sets a bit. | final public int | size() Calculates and returns the set's size in bits. | final public void | slowaddProduct(BitMatrix M, BitVector v) | public String | toString() Converts the BitVector to a String. | final public void | truncate(int newSize) Clear all the bits beyond newSize (newSize included), so that this
BitVector has less than newSize bits. | final public void | xor(BitVector set) |
UNDEFINED_INDEX | final public static int UNDEFINED_INDEX(Code) | | |
BitVector | public BitVector()(Code) | | Creates an empty set.
|
BitVector | public BitVector(int nbits)(Code) | | Creates an empty set with the specified size.
Parameters: nbits - the size of the set |
BitVector | public BitVector(BitVector old)(Code) | | Creates a copy of a BitVector.
|
addProduct | final public void addProduct(BitMatrix M, BitVector v)(Code) | | add to this the product of M by v, that is the BitVector v' such that v' =
union of all M.getRow(i) such that v.get(i) is true.
|
and | final public void and(BitVector set)(Code) | | Logically ANDs this bit set with the specified set of bits.
Parameters: set - the bit set to be ANDed with |
andNot | final public void andNot(BitVector set)(Code) | | do this = this & ~(set)
|
andNot | final public void andNot(int from, BitVector set)(Code) | | do this = this & (~set) on bits >= from
|
andNotOr | final public void andNotOr(int from, BitVector set1, BitVector set2)(Code) | | Do this = this & (~set1 | set2) on all bits >= from
|
bitCopy | final public void bitCopy(int src, int dest)(Code) | | Copy bit src into bit dest and clear src bit
|
bitCount | final public int bitCount()(Code) | | Computes the number of bits set in this BitVector.
This function is specially efficient on sparse bit sets.
NOTE: in previous implementations of MLsub type-checkers, there were
an average number of 2 bits set per vector...
|
bitCount | final public int bitCount(int n)(Code) | | Computes the number of bits set among the first n bits
|
bitMerge | final public void bitMerge(int src, int dest)(Code) | | Merge bit src and bit dest, put the result in bit dest.
|
clear | final public void clear(int bit)(Code) | | Clears a bit.
Parameters: bit - the bit to be cleared |
clearAll | final public void clearAll()(Code) | | Clear all the bits in this BitVector
|
equals | final public boolean equals(Object obj)(Code) | | Compares this object against the specified object.
Parameters: obj - the object to compare with true if the objects are the same; false otherwise. |
fill | final public void fill(int n)(Code) | | Fills the n first bit of this BitVector
|
fillNot | final public void fillNot(int n)(Code) | | Clears the first n bits of this BitVector
|
get | final public boolean get(int bit)(Code) | | Gets a bit.
Parameters: bit - the bit to be gotten |
getLowestClearedBit | final public int getLowestClearedBit()(Code) | | Compute the first cleared bit in this BitVector (a BitVector always
contains a finite number of set bits, so this method always returns a
value)
|
getLowestSetBit | final public int getLowestSetBit()(Code) | | Compute the first bit set in this BitVector or UNDEFINED_INDEX if this
set is empty.
|
getLowestSetBit | final public int getLowestSetBit(int pos)(Code) | | Compute the first bit set that is greater or equal than pos, or
UNDEFINED_INDEX if there is no such bit
|
getLowestSetBitAnd | final public int getLowestSetBitAnd(BitVector set)(Code) | | Compute the first bit in this & set
UNDEFINED_INDEX if there is no such bit |
getLowestSetBitNotIn | final public int getLowestSetBitNotIn(BitVector set)(Code) | | Compute the first bit set in this & ~set.
UNDEFINED_INDEX if there is no such bit |
getNextBit | public int getNextBit(int i)(Code) | | Gets the first bit set that is strictly greater than i or
UNDEFINED_INDEX if there is none
|
hashCode | final public int hashCode()(Code) | | Gets the hashcode.
|
includedIn | final public boolean includedIn(BitVector set)(Code) | | Return true if this BitVector is included in set
|
isEmpty | public boolean isEmpty()(Code) | | Returns true if no bit is set in this BitVector
|
set | public void set(int bit)(Code) | | Sets a bit.
Parameters: bit - the bit to be set |
size | final public int size()(Code) | | Calculates and returns the set's size in bits.
The maximum element in the set is the size - 1st element.
|
toString | public String toString()(Code) | | Converts the BitVector to a String.
|
truncate | final public void truncate(int newSize)(Code) | | Clear all the bits beyond newSize (newSize included), so that this
BitVector has less than newSize bits.
|
|
|