Chemical Data Processing Library Python API - Version 1.1.1
Public Member Functions | Static Public Attributes | Properties | List of all members
CDPL.Util.BitSet Class Reference

A dynamic bitset class. More...

+ Inheritance diagram for CDPL.Util.BitSet:

Public Member Functions

None __init__ ()
 Initializes the BitSet instance.
 
None __init__ (BitSet bs)
 Initializes a copy of the BitSet instance bs. More...
 
None __init__ (int num_bits, int value=0)
 Initializes the BitSet instance. More...
 
None __init__ (str bit_str)
 Initializes the BitSet instance. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
None swap (BitSet bs)
 
BitSet assign (BitSet bs)
 Replaces the current state of self with a copy of the state of the BitSet instance bs. More...
 
None resize (int num_bits, bool value=False)
 
None clear ()
 
None append (bool value)
 
BitSet flip ()
 
BitSet flip (int idx)
 
BitSet set ()
 
BitSet set (int idx, bool value=True)
 
BitSet reset ()
 
BitSet reset (int idx)
 
bool test (int idx)
 
int findFirst ()
 
int findNext (int idx)
 
bool isSubsetOf (BitSet bs)
 
bool isProperSubsetOf (BitSet bs)
 
bool isEmpty ()
 
int getCount ()
 
int getSize ()
 
int getMaxSize ()
 
bool hasAny ()
 
bool hasNone ()
 
bool __getitem__ (int idx)
 
None __setitem__ (int idx, bool value)
 
BitSet __and__ (BitSet bs)
 
BitSet __or__ (BitSet bs)
 
BitSet __xor__ (BitSet bs)
 
BitSet __sub__ (BitSet bs)
 Returns the result of the subtraction operation self - bs. More...
 
BitSet __iand__ (BitSet bs)
 
BitSet __ior__ (BitSet bs)
 
BitSet __ixor__ (BitSet bs)
 
BitSet __isub__ (BitSet bs)
 Performs the in-place subtraction operation self -= bs. More...
 
int __long__ ()
 
BitSet __ilshift__ (int num_bits)
 
BitSet __lshift__ (int num_bits)
 
BitSet __irshift__ (int num_bits)
 
BitSet __rshift__ (int num_bits)
 
BitSet __invert__ ()
 
bool __eq__ (BitSet bs)
 Returns the result of the comparison operation self == bs. More...
 
bool __ne__ (BitSet bs)
 Returns the result of the comparison operation self != bs. More...
 
bool __lt__ (BitSet bs)
 Returns the result of the comparison operation self < bs. More...
 
bool __le__ (BitSet bs)
 Returns the result of the comparison operation self <= bs. More...
 
bool __gt__ (BitSet bs)
 Returns the result of the comparison operation self > bs. More...
 
bool __ge__ (BitSet bs)
 Returns the result of the comparison operation self >= bs. More...
 
int __len__ ()
 
bool __nonzero__ ()
 
bool __bool__ ()
 
str __str__ ()
 Returns a string representation of the BitSet instance. More...
 

Static Public Attributes

int npos = 18446744073709551615
 

Properties

 objectID = property(getObjectID)
 
 empty = property(isEmpty)
 
 count = property(getCount)
 
 size = property(getSize)
 
 maxSize = property(getMaxSize)
 
 any = property(hasAny)
 
 none = property(hasNone)
 

Detailed Description

A dynamic bitset class.

For further information see [BDBS].

Constructor & Destructor Documentation

◆ __init__() [1/3]

None CDPL.Util.BitSet.__init__ ( BitSet  bs)

Initializes a copy of the BitSet instance bs.

Parameters
bsThe BitSet instance to copy.

◆ __init__() [2/3]

None CDPL.Util.BitSet.__init__ ( int  num_bits,
int   value = 0 
)

Initializes the BitSet instance.

Parameters
num_bits
value

◆ __init__() [3/3]

None CDPL.Util.BitSet.__init__ ( str  bit_str)

Initializes the BitSet instance.

Parameters
bit_str

Member Function Documentation

◆ getObjectID()

int CDPL.Util.BitSet.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python BitSet instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two BitSet instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ swap()

None CDPL.Util.BitSet.swap ( BitSet  bs)
Parameters
bs

◆ assign()

BitSet CDPL.Util.BitSet.assign ( BitSet  bs)

Replaces the current state of self with a copy of the state of the BitSet instance bs.

Parameters
bsThe BitSet instance to copy.
Returns
self

◆ resize()

None CDPL.Util.BitSet.resize ( int  num_bits,
bool   value = False 
)
Parameters
num_bits
value

◆ append()

None CDPL.Util.BitSet.append ( bool  value)
Parameters
value

◆ flip() [1/2]

BitSet CDPL.Util.BitSet.flip ( )
Returns

◆ flip() [2/2]

BitSet CDPL.Util.BitSet.flip ( int  idx)
Parameters
idx
Returns

◆ set() [1/2]

BitSet CDPL.Util.BitSet.set ( )
Returns

◆ set() [2/2]

BitSet CDPL.Util.BitSet.set ( int  idx,
bool   value = True 
)
Parameters
idx
value
Returns

◆ reset() [1/2]

BitSet CDPL.Util.BitSet.reset ( )
Returns

◆ reset() [2/2]

BitSet CDPL.Util.BitSet.reset ( int  idx)
Parameters
idx
Returns

◆ test()

bool CDPL.Util.BitSet.test ( int  idx)
Parameters
idx
Returns

◆ findFirst()

int CDPL.Util.BitSet.findFirst ( )
Returns

◆ findNext()

int CDPL.Util.BitSet.findNext ( int  idx)
Parameters
idx
Returns

◆ isSubsetOf()

bool CDPL.Util.BitSet.isSubsetOf ( BitSet  bs)
Parameters
bs
Returns

◆ isProperSubsetOf()

bool CDPL.Util.BitSet.isProperSubsetOf ( BitSet  bs)
Parameters
bs
Returns

◆ isEmpty()

bool CDPL.Util.BitSet.isEmpty ( )
Returns

◆ getCount()

int CDPL.Util.BitSet.getCount ( )
Returns

◆ getSize()

int CDPL.Util.BitSet.getSize ( )
Returns

◆ getMaxSize()

int CDPL.Util.BitSet.getMaxSize ( )
Returns

◆ hasAny()

bool CDPL.Util.BitSet.hasAny ( )
Returns

◆ hasNone()

bool CDPL.Util.BitSet.hasNone ( )
Returns

◆ __getitem__()

bool CDPL.Util.BitSet.__getitem__ ( int  idx)
Parameters
idx
Returns

◆ __setitem__()

None CDPL.Util.BitSet.__setitem__ ( int  idx,
bool  value 
)
Parameters
idx
value

◆ __and__()

BitSet CDPL.Util.BitSet.__and__ ( BitSet  bs)
Parameters
bs
Returns

◆ __or__()

BitSet CDPL.Util.BitSet.__or__ ( BitSet  bs)
Parameters
bs
Returns

◆ __xor__()

BitSet CDPL.Util.BitSet.__xor__ ( BitSet  bs)
Parameters
bs
Returns

◆ __sub__()

BitSet CDPL.Util.BitSet.__sub__ ( BitSet  bs)

Returns the result of the subtraction operation self - bs.

Parameters
bsSpecifies the subtrahend.
Returns
A BitSet instance holding the result of the subtraction.

◆ __iand__()

BitSet CDPL.Util.BitSet.__iand__ ( BitSet  bs)
Parameters
bs
Returns

◆ __ior__()

BitSet CDPL.Util.BitSet.__ior__ ( BitSet  bs)
Parameters
bs
Returns

◆ __ixor__()

BitSet CDPL.Util.BitSet.__ixor__ ( BitSet  bs)
Parameters
bs
Returns

◆ __isub__()

BitSet CDPL.Util.BitSet.__isub__ ( BitSet  bs)

Performs the in-place subtraction operation self -= bs.

Parameters
bsSpecifies the subtrahend.
Returns
The updated BitSet instance self.

◆ __long__()

int CDPL.Util.BitSet.__long__ ( )
Returns

◆ __ilshift__()

BitSet CDPL.Util.BitSet.__ilshift__ ( int  num_bits)
Parameters
num_bits
Returns

◆ __lshift__()

BitSet CDPL.Util.BitSet.__lshift__ ( int  num_bits)
Parameters
num_bits
Returns

◆ __irshift__()

BitSet CDPL.Util.BitSet.__irshift__ ( int  num_bits)
Parameters
num_bits
Returns

◆ __rshift__()

BitSet CDPL.Util.BitSet.__rshift__ ( int  num_bits)
Parameters
num_bits
Returns

◆ __invert__()

BitSet CDPL.Util.BitSet.__invert__ ( )
Returns

◆ __eq__()

bool CDPL.Util.BitSet.__eq__ ( BitSet  bs)

Returns the result of the comparison operation self == bs.

Parameters
bsThe BitSet instance to be compared with.
Returns
The result of the comparison operation.

◆ __ne__()

bool CDPL.Util.BitSet.__ne__ ( BitSet  bs)

Returns the result of the comparison operation self != bs.

Parameters
bsThe BitSet instance to be compared with.
Returns
The result of the comparison operation.

◆ __lt__()

bool CDPL.Util.BitSet.__lt__ ( BitSet  bs)

Returns the result of the comparison operation self < bs.

Parameters
bsThe BitSet instance to be compared with.
Returns
The result of the comparison operation.

◆ __le__()

bool CDPL.Util.BitSet.__le__ ( BitSet  bs)

Returns the result of the comparison operation self <= bs.

Parameters
bsThe BitSet instance to be compared with.
Returns
The result of the comparison operation.

◆ __gt__()

bool CDPL.Util.BitSet.__gt__ ( BitSet  bs)

Returns the result of the comparison operation self > bs.

Parameters
bsThe BitSet instance to be compared with.
Returns
The result of the comparison operation.

◆ __ge__()

bool CDPL.Util.BitSet.__ge__ ( BitSet  bs)

Returns the result of the comparison operation self >= bs.

Parameters
bsThe BitSet instance to be compared with.
Returns
The result of the comparison operation.

◆ __len__()

int CDPL.Util.BitSet.__len__ ( )
Returns

◆ __nonzero__()

bool CDPL.Util.BitSet.__nonzero__ ( )
Returns

◆ __bool__()

bool CDPL.Util.BitSet.__bool__ ( )
Returns

◆ __str__()

str CDPL.Util.BitSet.__str__ ( )

Returns a string representation of the BitSet instance.

Returns
The generated string representation.