BitArray class
A simple, fast array of bits, represented compactly by an array of ints internally.
@author Sean Owen
Constructors
- BitArray([int _size = 0])
- BitArray.test(Uint32List _bits, int _size)
Properties
- bits → Uint32List
-
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
no setter
- sizeInBytes → int
-
no setter
Methods
-
appendBit(
bool bit) → void -
appendBitArray(
BitArray other) → void -
appendBits(
int value, int numBits) → void - Appends the least-significant bits, from value, in order from most-significant to least-significant. For example, appending 6 bits from 0x000001E will append the bits 0, 1, 1, 1, 1, 0 in that order.
-
clear(
) → void - Clears all bits (sets to false).
-
clone(
) → BitArray -
flip(
int i) → void - Flips bit i.
-
get(
int i) → bool - @param i bit to get @return true iff bit i is set
-
getBitArray(
) → Uint32List - @return underlying array of ints. The first element holds the first 32 bits, and the least significant bit is bit 0.
-
getNextSet(
int from) → int - @param from first bit to check @return index of first bit that is set, starting from the given index, or size if none are set at or beyond this given index @see #getNextUnset(int)
-
getNextUnset(
int from) → int -
@param from index to start looking for unset bit
@return index of next unset bit, or
size
if none are unset until the end @see #getNextSet(int) -
isRange(
int start, int end, bool value) → bool - Efficient method to check if a range of bits is set, or not set.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reverse(
) → void - Reverses all bits in the array.
-
set(
int i) → void - Sets bit i.
-
setBulk(
int i, int newBits) → void - Sets a block of 32 bits, starting at bit i.
-
setRange(
int start, int end) → void - Sets a range of bits.
-
toBytes(
int bitOffset, Uint8List array, int offset, int numBytes) → void - @param bitOffset first bit to start writing @param array array to write into. Bytes are written most-significant byte first. This is the opposite of the internal representation, which is exposed by getBitArray @param offset position in array to start writing @param numBytes how many bytes to write
-
toString(
) → String -
A string representation of this object.
override
-
xor(
BitArray other) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
int i) → bool
Static Properties
- emptyBits → Uint32List
-
final
Constants
- loadFactor → const double