|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.BitVect
public final class BitVect
A class which implements a vector of bits similar to java.util.BitSet
.
$Id: BitVect.java,v 1.37 2007-10-04 19:58:10 burrill Exp $
Copyright 2007 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
This class differs from java.util.BitSet in that it saves space by not storing words, at the beginning and end of a vector, that are all zero bits.
BitSet
Constructor Summary | |
---|---|
BitVect()
Create a bit vector. |
|
BitVect(int nbits)
Create a bit vector with pre-allocated size for nbits bits. |
|
BitVect(int firstBit,
int lastBit)
Create a bit vector with pre-allocated size for a range of bits. |
Method Summary | |
---|---|
void |
and(BitVect o)
And this bit vector with the specified bit vector. |
void |
andNot(BitVect o)
And this bit vector with the logical complement of the specified bit vector. |
void |
andNotTo(int[] bits)
And the specified array with the logical complement of this bit vector. |
void |
clear(int index)
Clear the bit at the specified index. |
BitVect |
clone()
|
void |
copyTo(int[] bits)
Copy the bit vector into the specified int array. |
int |
count()
Return the number of bits set. |
void |
define(int[] o)
Set this bit vector with the specified array of bits. |
boolean |
empty()
Return true if the bit vector is all zeros. |
boolean |
equivalent(BitVect o)
Return true if the two bit vectors are identical. |
boolean |
get(int index)
Return the bit at the specified index. |
int[] |
getSetBits()
Return an array of integers specifying which bits are set. |
int |
getSetBits(int[] result)
Set an array of integers specifying which bits are set. |
static BitVect |
getSlice(int slice,
BitVect[] in)
Return a column of a bit array that is represented by an array of BitVect instances. |
void |
histogram(int[] hist)
Increase the histogram by one in every position there is a bit in the bit vector. |
boolean |
intersect(BitVect o)
Return true if the intersection is non-null. |
int |
intersectCount(BitVect o)
Return the number of intersections. |
int |
length()
Return the index plus one of the last bit set. |
void |
or(BitVect o)
Or this bit vector with the specified bit vector. |
boolean |
orAndTest(BitVect o)
Or this bit vector with the specified bit vector. |
boolean |
orTo(int[] bits)
Or this bit vector with the specified array. |
void |
outputSetBits()
Display the bits set by their index values. |
void |
reset()
Empty the bit vector. |
void |
set(int index)
Set the bit at the specified index. |
int |
size()
Return the number of bits actually in use to represent this bit vector. |
java.lang.String |
toString()
Return a String representation of the bit vector. |
static void |
transpose(BitVect[] out,
BitVect[] in)
Transpose a matrix of bits. |
void |
trim()
If possible, reduce the space required by this bit vector. |
void |
xor(BitVect o)
Exclusive or this bit vector with the specified bit vector. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BitVect()
public BitVect(int nbits)
nbits
bits.
public BitVect(int firstBit, int lastBit)
Method Detail |
---|
public BitVect clone()
clone
in class java.lang.Object
public void copyTo(int[] bits)
int
array.
The bit vector is represented by 32 bits per int
.
Bits are numbered right to left within a word.
The specified array must be large enough to hold all the bits.
public void reset()
public final void trim()
public int intersectCount(BitVect o)
public boolean intersect(BitVect o)
public void and(BitVect o)
public void andNot(BitVect o)
public void andNotTo(int[] bits)
public void or(BitVect o)
public boolean orAndTest(BitVect o)
public boolean orTo(int[] bits)
public void define(int[] o)
int
.
Bits are numbered right to left within a word.
public void xor(BitVect o)
public boolean equivalent(BitVect o)
public void set(int index)
public void clear(int index)
public boolean get(int index)
public int length()
public int count()
public boolean empty()
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
public void histogram(int[] hist)
public static void transpose(BitVect[] out, BitVect[] in)
out
- specifies the output arrayin
- is the array of BitVect instancespublic static BitVect getSlice(int slice, BitVect[] in)
slice
- specifies the columnin
- is the array of BitVect instancespublic int[] getSetBits()
public int getSetBits(int[] result)
count()
method to determine the proper size.
public void outputSetBits()
System.out
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |