BitArray class
Bit array to store bits.
Constructors
- BitArray(int length)
-
Creates a bit array with maximum
length
items.factory - BitArray.fromBitSet(BitSet set, {int? length})
-
Creates a bit array using a generic bit set.
factory
- BitArray.fromByteBuffer(ByteBuffer buffer)
-
Creates a bit array using a byte buffer.
factory
Properties
- byteBuffer → ByteBuffer
-
The backing, mutable byte buffer of the BitArray.
Use with caution.
no setter
- cardinality → int
-
The number of bits set to true.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether the BitArray is empty == has only zero values.
no setter
- isNotEmpty → bool
-
Whether the BitArray is not empty == has set values.
no setter
- length ↔ int
-
The number of bit in this BitArray.
getter/setter pairoverride-getter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
and(
BitSet set) → void -
Update the current BitArray using a logical AND operation with the
corresponding elements in the specified
set
. Excess size of theset
is ignored. -
andNot(
BitSet set) → void -
Update the current BitArray using a logical AND NOT operation with the
corresponding elements in the specified
set
. Excess size of theset
is ignored. -
asIntIterable(
[bool value = true]) → Iterable< int> -
Returns an iterable wrapper of the bit array that iterates over the index
numbers that match
value
(by default the bits that are set).override -
asUint32Iterable(
) → Iterable< int> -
Returns an iterable wrapper of the bit array that iterates over the index
numbers and returns the 32-bit int blocks.
override
-
clearAll(
) → void - Sets all of the bits in the current BitArray to false.
-
clearBit(
int index) → void -
Sets the bit specified by the
index
to false. -
clearBits(
Iterable< int> indexes) → void -
Sets the bits specified by the
indexes
to false. -
clone(
) → BitArray -
Creates a copy of the current BitArray.
override
-
invertAll(
) → void - Inverts all the bit values in the current BitArray.
-
invertBit(
int index) → void -
Inverts the bit specified by the
index
. -
invertBits(
Iterable< int> indexes) → void -
Inverts the bits specified by the
indexes
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
or(
BitSet set) → void -
Update the current BitArray using a logical OR operation with the
corresponding elements in the specified
set
. Excess size of theset
is ignored. -
setAll(
) → void - Sets all the bit values in the current BitArray to true.
-
setBit(
int index) → void -
Sets the bit specified by the
index
to true. -
setBits(
Iterable< int> indexes) → void -
Sets the bits specified by the
indexes
to true. -
toBinaryString(
) → String - Creates a string of 0s and 1s of the content of the array.
-
toString(
) → String -
A string representation of this object.
inherited
-
xor(
BitSet set) → void -
Update the current BitArray using a logical XOR operation with the
corresponding elements in the specified
set
. Excess size of theset
is ignored.
Operators
-
operator %(
BitSet set) → BitArray -
Creates a BitArray using a logical AND NOT operation with the
corresponding elements in the specified
set
. Excess size of theset
is ignored. -
operator &(
BitSet set) → BitArray -
Creates a BitArray using a logical AND operation with the
corresponding elements in the specified
set
. Excess size of theset
is ignored. -
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → bool -
The value of the bit with the specified
index
.override -
operator []=(
int index, bool value) → void -
Sets the bit specified by the
index
to thevalue
. -
operator ^(
BitSet set) → BitArray -
Creates a BitArray using a logical XOR operation with the
corresponding elements in the specified
set
. Excess size of theset
is ignored. -
operator |(
BitSet set) → BitArray -
Creates a BitArray using a logical OR operation with the
corresponding elements in the specified
set
. Excess size of theset
is ignored.