Package pyjsdl :: Module pyjsarray :: Class BitSet

Class BitSet

object --+
         |
        BitSet

BitSet provides a bitset object to use in a Python-to-JavaScript application. The object stores data in a JavaScript Uint8Array 8-bit typedarray. BitSet16 and BitSet32 stores data in Uint16Array (16-bit) and Uint32Array (32-bit) typedarray. The BitSet will dynamically expand to hold the bits required, an optional width argument define number of bits the BitSet instance will initially hold.
Instance Methods
 
__init__(self, width=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__str__(self)
str(x)
 
__repr__(self)
repr(x)
 
__getitem__(self, index)
 
__setitem__(self, index, value)
 
__len__(self)
 
__iter__(self)
 
get(self, index, toIndex=None)
Get bit by index. Arguments include index of bit, and optional toIndex that return a slice as a BitSet.
 
set(self, index, value=1)
Set bit by index. Optional argument value is the bit state of 1(True) or 0(False). Default:1
 
fill(self, index=None, toIndex=None)
Set the bit. If no argument provided, all bits are set. Optional argument index is bit index to set, and toIndex to set a range of bits.
 
clear(self, index=None, toIndex=None)
Clear the bit. If no argument provided, all bits are cleared. Optional argument index is bit index to clear, and toIndex to clear a range of bits.
 
flip(self, index, toIndex=None)
Flip the state of the bit. Argument index is the bit index to flip, and toIndex to flip a range of bits.
 
cardinality(self)
Return the count of bit set.
 
intersects(self, bitset)
Check if set bits in this BitSet are also set in the bitset argument. Return True if bitsets intersect, otherwise return False.
 
andSet(self, bitset)
BitSet and BitSet.
 
orSet(self, bitset)
BitSet or BitSet.
 
xorSet(self, bitset)
BitSet xor BitSet.
 
resize(self, width)
Resize the BitSet to width argument.
 
size(self)
Return bits used by BitSet storage array.
 
isEmpty(self)
Check whether any bit is set. Return True if none set, otherwise return False.
 
clone(self)
Return a copy of the BitSet.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, width=None)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

 
str(x)
Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)