Packagede.polygonal.ds
Classpublic class BitVector
InheritanceBitVector Inheritance Object
Subclasses BitBoard

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.



Public Properties
 PropertyDefined By
  bitCount : int
[read-only] The total number of bits.
BitVector
  cellCount : int
[read-only] The total number of cells.
BitVector
Public Methods
 MethodDefined By
  
BitVector(bits:int)
Creates a bit-vector with a given number of bits.
BitVector
  
clear():void
Resets all bits to 0;
BitVector
  
getBit(index:int):int
Gets a bit from a given index.
BitVector
  
resize(size:int):void
Resizes the bit-vector to an appropriate number of bits.
BitVector
  
setAll():void
Sets each bit to 1.
BitVector
  
setBit(index:int, b:Boolean):void
Sets a bit at a given index.
BitVector
  
toString():String
Prints out a string representing the current object.
BitVector
Property Detail
bitCountproperty
bitCount:int  [read-only]

The total number of bits.


Implementation
    public function get bitCount():int
cellCountproperty 
cellCount:int  [read-only]

The total number of cells.


Implementation
    public function get cellCount():int
Constructor Detail
BitVector()Constructor
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
bits:int — The total number of bits.
Method Detail
clear()method
public function clear():void

Resets all bits to 0;

getBit()method 
public function getBit(index:int):int

Gets a bit from a given index.

Parameters

index:int — The index of the bit.

Returns
int
resize()method 
public function resize(size:int):void

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

Parameters

size:int — The total number of bits.

setAll()method 
public function setAll():void

Sets each bit to 1.

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

Sets a bit at a given index.

Parameters

index:int — The index of the bit.
 
b:Boolean — The boolean flag to set.

toString()method 
public function toString():String

Prints out a string representing the current object.

Returns
String — A string representing the current object.