Chemical Data Processing Library Python API - Version 1.2.0
Public Member Functions | Properties | List of all members
CDPL.Chem.BondContainer Class Reference

A common interface for data-structures that support a random access to stored Chem.Bond instances. More...

+ Inheritance diagram for CDPL.Chem.BondContainer:

Public Member Functions

None __init__ ()
 Initializes the BondContainer instance.
 
Bond getBond (int idx)
 Returns a reference to the bond at index idx. More...
 
bool containsBond (Bond bond)
 Tells whether the specified Chem.Bond instance is stored in this container. More...
 
None orderBonds (BoolBond2Functor func)
 Orders the stored bonds according to criteria implemented by the provided bond comparison function. More...
 
int getBondIndex (Bond bond)
 Returns the index of the specified Chem.Bond instance in this container. More...
 
int getNumBonds ()
 Returns the number of stored Chem.Bond objects. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
bool __contains__ (Bond bond)
 Returns the result of the membership test operation bond in self. More...
 
Bond __getitem__ (int idx)
 
int __len__ ()
 

Properties

 objectID = property(getObjectID)
 
 numBonds = property(getNumBonds)
 

Detailed Description

A common interface for data-structures that support a random access to stored Chem.Bond instances.

Implementations have to guarantee that a given Chem.Bond object is stored only once and its index is unique amongst all contained Chem.Bond instances. Otherwise algorithms that rely on this behaviour may not work correctly!

Member Function Documentation

◆ getBond()

Bond CDPL.Chem.BondContainer.getBond ( int  idx)

Returns a reference to the bond at index idx.

Parameters
idxThe zero-based index of the Chem.Bond instance to return.
Returns
A reference to the bond at the specified index.
Exceptions
Base.IndexErrorif the number of bonds is zero or idx is not in the range [0, getNumBonds() - 1].

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, and CDPL.Chem.Atom.

◆ containsBond()

bool CDPL.Chem.BondContainer.containsBond ( Bond  bond)

Tells whether the specified Chem.Bond instance is stored in this container.

Parameters
bondThe Chem.Bond instance to look for.
Returns
True if bond is stored in the container, and False otherwise.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, and CDPL.Chem.Atom.

◆ orderBonds()

None CDPL.Chem.BondContainer.orderBonds ( BoolBond2Functor  func)

Orders the stored bonds according to criteria implemented by the provided bond comparison function.

Parameters
funcThe bond comparison function implementing the applied ordering criteria.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, and CDPL.Chem.Atom.

◆ getBondIndex()

int CDPL.Chem.BondContainer.getBondIndex ( Bond  bond)

Returns the index of the specified Chem.Bond instance in this container.

Parameters
bondThe Chem.Bond instance for which to return the index.
Returns
The zero-based index of the specified Chem.Bond instance.
Exceptions
Base.ItemNotFoundif the specified Chem.Bond instance could not be found.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, and CDPL.Chem.Atom.

◆ getNumBonds()

int CDPL.Chem.BondContainer.getNumBonds ( )

Returns the number of stored Chem.Bond objects.

Returns
The number of stored Chem.Bond objects.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, and CDPL.Chem.Atom.

◆ getObjectID()

int CDPL.Chem.BondContainer.getObjectID ( )

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

Different Python BondContainer 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 BondContainer 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.

Reimplemented in CDPL.ConfGen.CanonicalFragment.

◆ __contains__()

bool CDPL.Chem.BondContainer.__contains__ ( Bond  bond)

Returns the result of the membership test operation bond in self.

Parameters
bondThe value to test for membership.
Returns
The result of the membership test operation.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.MolecularGraph, CDPL.Chem.Fragment, and CDPL.Chem.Atom.

◆ __getitem__()

Bond CDPL.Chem.BondContainer.__getitem__ ( int  idx)
Parameters
idx
Returns

Reimplemented in CDPL.Biomol.HierarchyViewModel, and CDPL.Biomol.HierarchyViewChain.

◆ __len__()

int CDPL.Chem.BondContainer.__len__ ( )