|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.opencores.JLex.SparseBitSet
A set of bits. The set automatically grows as more bits are needed.
| Inner Class Summary | |
private static interface |
SparseBitSet.BinOp
|
| Field Summary | |
private static SparseBitSet.BinOp |
AND
|
(package private) long[] |
bits
Array of bit-blocks; each holding BITS bits. |
private static int |
BITS
Number of bits in a block. |
private static int |
BITS_M1
BITS-1, using the identity: x % BITS == x & (BITS-1) |
private static int |
LG_BITS
log base 2 of BITS, for the identity: x/BITS == x >> LG_BITS |
(package private) int[] |
offs
Sorted array of bit-block offsets. |
private static SparseBitSet.BinOp |
OR
|
(package private) int |
size
Number of blocks currently in use. |
private static SparseBitSet.BinOp |
XOR
|
| Constructor Summary | |
SparseBitSet()
Creates an empty set. |
|
SparseBitSet(int nbits)
Creates an empty set with the specified size. |
|
SparseBitSet(SparseBitSet set)
Creates an empty set with the same size as the given set. |
|
| Method Summary | |
void |
and(SparseBitSet set)
Logically ANDs this bit set with the specified set of bits. |
private static void |
binop(SparseBitSet a,
SparseBitSet b,
SparseBitSet.BinOp op)
|
private int |
bsearch(int bnum)
|
void |
clear(int bit)
Clears a bit. |
void |
clearAll()
Clears all bits. |
java.lang.Object |
clone()
Clones the SparseBitSet. |
java.util.Enumeration |
elements()
Return an Enumeration of Integers
which represent set bit indices in this SparseBitSet. |
boolean |
equals(java.lang.Object obj)
Compares this object against the specified object. |
static boolean |
equals(SparseBitSet a,
SparseBitSet b)
Compares two SparseBitSets for equality. |
boolean |
get(int bit)
Gets a bit. |
int |
hashCode()
Gets the hashcode. |
private void |
insert_block(int idx,
int bnum)
|
private boolean |
isValid()
Check validity. |
static void |
main(java.lang.String[] args)
Self-test. |
private void |
new_block(int bnum)
|
private void |
new_block(int idx,
int bnum)
|
void |
or(SparseBitSet set)
Logically ORs this bit set with the specified set of bits. |
void |
set(int bit)
Sets a bit. |
int |
size()
Calculates and returns the set's size |
java.lang.String |
toString()
Converts the SparseBitSet to a String. |
void |
xor(SparseBitSet set)
Logically XORs this bit set with the specified set of bits. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
int[] offs
long[] bits
int size
private static final int LG_BITS
private static final int BITS
private static final int BITS_M1
private static final SparseBitSet.BinOp AND
private static final SparseBitSet.BinOp OR
private static final SparseBitSet.BinOp XOR
| Constructor Detail |
public SparseBitSet()
public SparseBitSet(int nbits)
nbits - the size of the setpublic SparseBitSet(SparseBitSet set)
| Method Detail |
private void new_block(int bnum)
private void new_block(int idx,
int bnum)
private void insert_block(int idx,
int bnum)
private int bsearch(int bnum)
public void set(int bit)
bit - the bit to be setpublic void clear(int bit)
bit - the bit to be clearedpublic void clearAll()
public boolean get(int bit)
bit - the bit to be gottenpublic void and(SparseBitSet set)
set - the bit set to be ANDed withpublic void or(SparseBitSet set)
set - the bit set to be ORed withpublic void xor(SparseBitSet set)
set - the bit set to be XORed with
private static final void binop(SparseBitSet a,
SparseBitSet b,
SparseBitSet.BinOp op)
public int hashCode()
public int size()
public boolean equals(java.lang.Object obj)
obj - the object to commpare with
public static boolean equals(SparseBitSet a,
SparseBitSet b)
public java.lang.Object clone()
public java.util.Enumeration elements()
Enumeration of Integers
which represent set bit indices in this SparseBitSet.public java.lang.String toString()
private boolean isValid()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||