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

A container for the storage and evaluation of logical match expression lists. More...

+ Inheritance diagram for CDPL.Chem.AtomMatchExpressionList:

Public Member Functions

None __init__ ()
 Creates an empty list.
 
None __init__ (AtomMatchExpressionList expr)
 Initializes a copy of the AtomMatchExpressionList instance expr. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
int getSize ()
 Returns the number of elements stored in the list. More...
 
bool isEmpty ()
 Tells whether the list is empty (getSize() == 0). More...
 
None resize (int num_elem, AtomMatchExpression value)
 Inserts or erases elements at the end so that the size becomes num_elem. More...
 
None reserve (int num_elem)
 Preallocates memory for (at least) num_elem elements. More...
 
int getCapacity ()
 Returns the number of elements for which memory has been allocated. More...
 
None clear ()
 Erases all elements.
 
AtomMatchExpressionList assign (AtomMatchExpressionList array)
 Replaces the current state of self with a copy of the state of the AtomMatchExpressionList instance array. More...
 
None assign (int num_elem, AtomMatchExpression value)
 This function fills the list with num_elem copies of the given value. More...
 
None addElement (AtomMatchExpression value)
 Inserts a new element at the end of the list. More...
 
None addElements (AtomMatchExpressionList values)
 
None insertElement (int idx, AtomMatchExpression value)
 Inserts a new element before the location specified by the index idx. More...
 
None insertElements (int idx, int num_elem, AtomMatchExpression value)
 Inserts num_elem copies of value before the location specified by the index idx. More...
 
None insertElements (int index, AtomMatchExpressionList values)
 
None popLastElement ()
 Removes the last element of the list. More...
 
None removeElement (int idx)
 Removes the element at the position specified by the index idx. More...
 
None removeElements (int begin_idx, int end_idx)
 
AtomMatchExpression getFirstElement ()
 Returns a reference to the first element of the list. More...
 
AtomMatchExpression getLastElement ()
 Returns a reference to the last element of the list. More...
 
AtomMatchExpression getElement (int idx)
 Returns a reference to the element at index idx. More...
 
None setElement (int idx, AtomMatchExpression value)
 Assigns a new value to the element specified by the index idx. More...
 
None __delitem__ (int idx)
 
AtomMatchExpression __getitem__ (int idx)
 
int __len__ ()
 
None __setitem__ (int index, AtomMatchExpression value)
 
bool __eq__ (object expr)
 Returns the result of the comparison operation self == expr. More...
 
bool __ne__ (object expr)
 Returns the result of the comparison operation self != expr. More...
 
- Public Member Functions inherited from CDPL.Chem.AtomMatchExpression
bool requiresAtomBondMapping ()
 Tells whether the expression must be reevaluated after a query to target atom/bond mapping candidate has been found. More...
 
bool __call__ (Atom query_atom, MolecularGraph query_molgraph, Atom target_atom, MolecularGraph target_molgraph, Base.Any aux_data)
 Performs an evaluation of the expression for the given query and target objects. More...
 
bool __call__ (Atom query_atom, MolecularGraph query_molgraph, Atom target_atom, MolecularGraph target_molgraph, AtomBondMapping mapping, Base.Any aux_data)
 Performs an evaluation of the expression for the given query and target objects under consideration of the provided candidate atom/bond mapping. More...
 

Properties

 objectID = property(getObjectID)
 
 size = property(getSize)
 
- Properties inherited from CDPL.Chem.AtomMatchExpression
 objectID = property(getObjectID)
 

Detailed Description

A container for the storage and evaluation of logical match expression lists.

AtomMatchExpressionList allows for a concatenation of multiple Chem.AtomMatchExpression instances that get evaluated in turn according to some logic. The actual logic of expression list evaluation has to be implemented by subclasses by overriding the virtual function call operator methods of the Chem.AtomMatchExpression interface.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.AtomMatchExpressionList.__init__ ( AtomMatchExpressionList  expr)

Initializes a copy of the AtomMatchExpressionList instance expr.

Parameters
exprThe AtomMatchExpressionList instance to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.AtomMatchExpressionList.getObjectID ( )

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

Different Python AtomMatchExpressionList 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 AtomMatchExpressionList 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 from CDPL.Chem.AtomMatchExpression.

◆ getSize()

int CDPL.Chem.AtomMatchExpressionList.getSize ( )

Returns the number of elements stored in the list.

Returns
The size of the list.

◆ isEmpty()

bool CDPL.Chem.AtomMatchExpressionList.isEmpty ( )

Tells whether the list is empty (getSize() == 0).

Returns
True if the list is empty, False otherwise.

◆ resize()

None CDPL.Chem.AtomMatchExpressionList.resize ( int  num_elem,
AtomMatchExpression  value 
)

Inserts or erases elements at the end so that the size becomes num_elem.

Parameters
num_elemThe new size.
valueThe value for newly inserted elements.

◆ reserve()

None CDPL.Chem.AtomMatchExpressionList.reserve ( int  num_elem)

Preallocates memory for (at least) num_elem elements.

If num_elem is less than or equal to the current capacity, this call has no effect. Otherwise, it is a request for allocation of additional memory. If the request is successful, then the capacity is greater than or equal to num_elem. Otherwise, the capacity is unchanged. In either case, the number of elements will not change.

Parameters
num_elemThe number of elements to reserve memory for.
See also
getCapacity()

◆ getCapacity()

int CDPL.Chem.AtomMatchExpressionList.getCapacity ( )

Returns the number of elements for which memory has been allocated.

The capacity is always greater than or equal to the number of currently stored elements.

Returns
The current capacity.

◆ assign() [1/2]

AtomMatchExpressionList CDPL.Chem.AtomMatchExpressionList.assign ( AtomMatchExpressionList  array)

Replaces the current state of self with a copy of the state of the AtomMatchExpressionList instance array.

Parameters
arrayThe AtomMatchExpressionList instance to copy.
Returns
self

◆ assign() [2/2]

None CDPL.Chem.AtomMatchExpressionList.assign ( int  num_elem,
AtomMatchExpression  value 
)

This function fills the list with num_elem copies of the given value.

Note that the assignment completely changes the list and the new size is the same as the number of elements assigned. Old data will be lost.

Parameters
num_elemThe number of elements to be assigned.
valueThe value to be assigned.

◆ addElement()

None CDPL.Chem.AtomMatchExpressionList.addElement ( AtomMatchExpression  value)

Inserts a new element at the end of the list.

Parameters
valueThe value of the new element.

◆ addElements()

None CDPL.Chem.AtomMatchExpressionList.addElements ( AtomMatchExpressionList  values)
Parameters
values

◆ insertElement()

None CDPL.Chem.AtomMatchExpressionList.insertElement ( int  idx,
AtomMatchExpression  value 
)

Inserts a new element before the location specified by the index idx.

Parameters
idxThe location where to insert the new element.
valueThe value of the element to insert.
Exceptions
Base.IndexErrorif the list is empty or idx is not in the range [0, getSize()].

◆ insertElements() [1/2]

None CDPL.Chem.AtomMatchExpressionList.insertElements ( int  idx,
int  num_elem,
AtomMatchExpression  value 
)

Inserts num_elem copies of value before the location specified by the index idx.

Parameters
idxThe location where to insert the new elements.
num_elemThe number of elements to insert.
valueThe value of the elements to insert.
Exceptions
Base.IndexErrorif idx is not in the range [0, getSize()].

◆ insertElements() [2/2]

None CDPL.Chem.AtomMatchExpressionList.insertElements ( int  index,
AtomMatchExpressionList  values 
)
Parameters
index
values

◆ popLastElement()

None CDPL.Chem.AtomMatchExpressionList.popLastElement ( )

Removes the last element of the list.

Exceptions
Base.OperationFailedif the list is empty.

◆ removeElement()

None CDPL.Chem.AtomMatchExpressionList.removeElement ( int  idx)

Removes the element at the position specified by the index idx.

Parameters
idxThe zero-based index of the element to remove.
Exceptions
Base.IndexErrorif the list is empty or idx is not in the range [0, getSize() - 1].

◆ removeElements()

None CDPL.Chem.AtomMatchExpressionList.removeElements ( int  begin_idx,
int  end_idx 
)
Parameters
begin_idx
end_idx

◆ getFirstElement()

AtomMatchExpression CDPL.Chem.AtomMatchExpressionList.getFirstElement ( )

Returns a reference to the first element of the list.

Returns
A reference to the first element.
Exceptions
Base.OperationFailedif the list is empty.

◆ getLastElement()

AtomMatchExpression CDPL.Chem.AtomMatchExpressionList.getLastElement ( )

Returns a reference to the last element of the list.

Returns
A reference to the last element.
Exceptions
Base.OperationFailedif the list is empty.

◆ getElement()

AtomMatchExpression CDPL.Chem.AtomMatchExpressionList.getElement ( int  idx)

Returns a reference to the element at index idx.

The method is equivalent to operator[](std::size_t).

Parameters
idxThe zero-based index of the element.
Returns
A reference to the element.
Exceptions
Base.IndexErrorif the list is empty or idx is not in the range [0, getSize() - 1].

◆ setElement()

None CDPL.Chem.AtomMatchExpressionList.setElement ( int  idx,
AtomMatchExpression  value 
)

Assigns a new value to the element specified by the index idx.

Parameters
idxThe zero-based index of the element for which to assign a new value.
valueThe new value of the element after assignment.
Exceptions
Base.IndexErrorif the list is empty or idx is not in the range [0, getSize() - 1].

◆ __delitem__()

None CDPL.Chem.AtomMatchExpressionList.__delitem__ ( int  idx)
Parameters
idx

◆ __getitem__()

AtomMatchExpression CDPL.Chem.AtomMatchExpressionList.__getitem__ ( int  idx)
Parameters
idx
Returns

◆ __len__()

int CDPL.Chem.AtomMatchExpressionList.__len__ ( )
Returns

◆ __setitem__()

None CDPL.Chem.AtomMatchExpressionList.__setitem__ ( int  index,
AtomMatchExpression  value 
)
Parameters
index
value

◆ __eq__()

bool CDPL.Chem.AtomMatchExpressionList.__eq__ ( object  expr)

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

Parameters
exprThe object instance to be compared with.
Returns
The result of the comparison operation.

◆ __ne__()

bool CDPL.Chem.AtomMatchExpressionList.__ne__ ( object  expr)

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

Parameters
exprThe object instance to be compared with.
Returns
The result of the comparison operation.