GODPAPER | All Packages | All Classes | Index | Frames No Frames |
BitVectors

Package | com.lookbackon.ds
Class | public class BitVectors
Inheritance | BitVectors Object

the implementation would look something like this: //offline var n:uint = objects.length; var bv:BitVector = new BitVector( null, n ( n - 1 ) / 2 ); //test function handleCollision( minObj:CollidableObject, maxObj:CollidableObject ) : void { var bit:uint = minObj.index ( 2 n - minObj.index - 3 ) / 2 + maxObj.index - 1; if( !bv.getBit( bit ) ){ //test for collision bv.setBit( bit, true ); } }

See also

http://blog.generalrelativity.org/actionscript-30/avm2-memory-considerations-and-bit-vectors/

Public Properties

| Property | Defined By
--- | --- | ---
|  | bits : uint [read-only] | BitVectors
|  | bytes : uint [read-only] | BitVectors
|  | length : uint [read-only] | BitVectors

Public Methods

| Method | Defined By
--- | --- | ---
|  | BitVectors(source:Vector.<uint> = null, numBits:uint = 128) | BitVectors
|  | AND(bitVector:BitVectors):BitVectors | BitVectors
|  | flagAllOff():void | BitVectors
|  | flagAllOn():void | BitVectors
|  | getBit(bit:uint):uint | BitVectors
|  | OR(bitVector:BitVectors):BitVectors | BitVectors
|  | setBit(bit:uint, flag:Boolean = true):void | BitVectors
|  | toString():String | BitVectors

Property Detail

bits | property

`bits:uint` [read-only]

Implementation
`public function get bits():uint`

bytes | property |

`bytes:uint` [read-only]

Implementation
`public function get bytes():uint`

length | property |

`length:uint` [read-only]

Implementation
`public function get length():uint`
Constructor Detail

BitVectors | () | Constructor

`public function BitVectors(source:Vector.<uint> = null, numBits:uint = 128)`

Parameters

| `source:Vector.<uint>` (default = `null`)``
| `numBits:uint` (default = `128`)``

Method Detail

AND | () | method

`public function AND(bitVector:BitVectors):BitVectors`

Parameters

| `bitVector:BitVectors`

Returns

| `BitVectors`

flagAllOff | () | method |

`public function flagAllOff():void`

flagAllOn | () | method |

`public function flagAllOn():void`

getBit | () | method |

`public function getBit(bit:uint):uint`

Parameters

| `bit:uint`

Returns

| `uint`

OR | () | method |

`public function OR(bitVector:BitVectors):BitVectors`

Parameters

| `bitVector:BitVectors`

Returns

| `BitVectors`

setBit | () | method |

`public function setBit(bit:uint, flag:Boolean = true):void`

Parameters

| `bit:uint`
| `flag:Boolean` (default = `true`)``

toString | () | method |

`public function toString():String`

Returns

| `String`

Thu Jan 16 2014, 01:11 PM +08:00