Method | Description | |
---|---|---|
BitSet ( ) : System |
Create a new empty bit set. All bits are initially false.
|
|
BitSet ( int nbits ) : System |
Create a new empty bit set, with a given size. This constructor reserves enough space to represent the integers from
|
|
Equals ( object obj ) : bool |
Returns true if the
|
|
GetHashCode ( ) : int |
Returns a hash code value for this bit set. The hash code of two bit sets containing the same integers is identical. The algorithm used to compute it is as follows: Suppose the bits in the BitSet were to be stored in an array of long integers called public override int GetHashCode() { long h = 1234; for (int i = bits.length-1; i >= 0; i--) { h ^= bits[i] * (i + 1); } return (int)((h >> 32) ^ h); }Note that the hash code values changes, if the set is changed.
|
|
ToString ( ) : string |
Returns the string representation of this bit set. This consists of a comma separated list of the integers in this set surrounded by curly braces. There is a space after each comma. A sample string is thus "{1, 3, 53}".
|
|
and ( |
Performs the logical AND operation on this bit set and the given
|
|
andNot ( |
Performs the logical AND operation on this bit set and the complement of the given
|
|
cardinality ( ) : int |
Returns the number of bits set to true.
|
|
clear ( ) : void |
Sets all bits in the set to false.
|
|
clear ( int pos ) : void |
Removes the integer
|
|
clear ( int from, int to ) : void |
Sets the bits between from (inclusive) and to (exclusive) to false.
|
|
clone ( ) : object |
Create a clone of this bit set, that is an instance of the same class and contains the same elements. But it doesn't change when this bit set changes.
|
|
containsAll ( |
||
flip ( int index ) : void |
Sets the bit at the index to the opposite value.
|
|
flip ( int from, int to ) : void |
Sets a range of bits to the opposite value.
|
|
get ( int from, int to ) : |
Returns a new
|
|
get ( int pos ) : System.Boolean |
Returns true if the integer
|
|
intersects ( |
Returns true if the specified BitSet and this one share at least one common true bit.
|
|
isEmpty ( ) : bool |
Returns true if this set contains no true bits.
|
|
nextClearBit ( int from ) : int |
Returns the index of the next false bit, from the specified bit (inclusive).
|
|
nextSetBit ( int from ) : int |
Returns the index of the next true bit, from the specified bit (inclusive). If there is none, -1 is returned. You can iterate over all true bits with this loop: for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { // operate on i here }
|
|
or ( |
Performs the logical OR operation on this bit set and the given
|
|
set ( int pos ) : void |
Add the integer
|
|
set ( int index, bool value ) : void |
Sets the bit at the given index to the specified value. The size of this structure is automatically increased as necessary.
|
|
set ( int from, int to ) : void |
Sets the bits between from (inclusive) and to (exclusive) to true.
|
|
set ( int from, int to, bool value ) : void |
Sets the bits between from (inclusive) and to (exclusive) to the specified value.
|
|
xor ( |
Performs the logical XOR operation on this bit set and the given
|
Method | Description | |
---|---|---|
ensure ( int lastElt ) : void |
Make sure the vector is big enough.
|
public BitSet ( int nbits ) : System | ||
nbits | int | nbits the initial size of the bit set |
return | System |
public Equals ( object obj ) : bool | ||
obj | object | the object to compare to |
return | bool |
public clear ( int from, int to ) : void | ||
from | int | the start range (inclusive) |
to | int | the end range (exclusive) |
return | void |
public flip ( int from, int to ) : void | ||
from | int | the low index (inclusive) |
to | int | the high index (exclusive) |
return | void |
public get ( int from, int to ) : |
||
from | int | the low index (inclusive) |
to | int | the high index (exclusive) |
return |
public get ( int pos ) : System.Boolean | ||
pos | int | a non-negative integer |
return | System.Boolean |
public intersects ( |
||
set | the set to check for intersection | |
return | bool |
public nextClearBit ( int from ) : int | ||
from | int | the start location |
return | int |
public nextSetBit ( int from ) : int | ||
from | int | the start location |
return | int |
public set ( int index, bool value ) : void | ||
index | int | the position to set |
value | bool | the value to set it to |
return | void |
public set ( int from, int to ) : void | ||
from | int | the start range (inclusive) |
to | int | the end range (exclusive) |
return | void |
public set ( int from, int to, bool value ) : void | ||
from | int | the start range (inclusive) |
to | int | the end range (exclusive) |
value | bool | the value to set it to |
return | void |