BitVector

A bit-vector.

A bit-vector is meant to condense bit values (or booleans) into an array as close as possible so that no space is wasted.

Summary
BitVectorA bit-vector.
Functions and Properties
BitVectorCreates a bit-vector with a given number of bits.
bitCountThe total number of bits.
cellCountThe total number of cells.
getBitGets a bit from a given index.
setBitSets a bit at a given index.
resizeResizes the bit-vector to an appropriate number of bits.
clearResets all bits to 0;
setAllSets each bit to 1.
toStringPrints out a string representing the current object.

Functions and Properties

BitVector

public function BitVector(bits: int)

Creates a bit-vector with a given number of bits.  Each cell holds an int, allowing to store 32 flags each.

Parameters

bitsThe total number of bits. 

bitCount

public function get bitCount():int

The total number of bits.

cellCount

public function get cellCount():int

The total number of cells.

getBit

public function getBit(index: int):int

Gets a bit from a given index.

Parameters

indexThe index of the bit. 

setBit

public function setBit(index: int,
b: Boolean):void

Sets a bit at a given index.

Parameters

indexThe index of the bit.
bThe boolean flag to set. 

resize

public function resize(size: int):void

Resizes the bit-vector to an appropriate number of bits.

Parameters

sizeThe total number of bits. 

clear

public function clear():void

Resets all bits to 0;

setAll

public function setAll():void

Sets each bit to 1.

toString

public function toString():String

Prints out a string representing the current object.

Returns

A string representing the current object. 

public function BitVector(bits: int)
Creates a bit-vector with a given number of bits.
public function get bitCount():int
The total number of bits.
public function get cellCount():int
The total number of cells.
public function getBit(index: int):int
Gets a bit from a given index.
public function setBit(index: int,
b: Boolean):void
Sets a bit at a given index.
public function resize(size: int):void
Resizes the bit-vector to an appropriate number of bits.
public function clear():void
Resets all bits to 0;
public function setAll():void
Sets each bit to 1.
public function toString():String
Prints out a string representing the current object.
Close