Data type for the storage and lookup of arbitrary atom to atom mappings.
More...
|
|
None | __init__ () |
| | Creates an empty map.
|
| |
| None | __init__ (AtomMapping mapping) |
| | Initializes a copy of the AtomMapping instance mapping. More...
|
| |
| int | getObjectID () |
| | Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
|
| |
| int | getSize () |
| | Returns the size (number of entries) of the map. More...
|
| |
| bool | isEmpty () |
| | Tells whether the map is empty (getSize() == 0). More...
|
| |
|
None | clear () |
| | Erases all entries.
|
| |
| AtomMapping | assign (AtomMapping map) |
| | Replaces the current state of self with a copy of the state of the AtomMapping instance map. More...
|
| |
| Atom | getValue (Atom key) |
| | Returns a reference to the first value associated with the specified key. More...
|
| |
| Atom | getValue (Atom key, Atom def_value) |
| | Returns a reference to the first value associated with the specified key, or the value given by the second argument if an entry with the given key does not exist. More...
|
| |
| bool | removeEntry (Atom key) |
| | Removes the first entry with the specified key from the map. More...
|
| |
| None | setEntry (Atom key, Atom value) |
| | Replaces all entries with a key equivalent to key with a single copy of the key/value pair (key, value). More...
|
| |
|
object | getKeys () |
| |
|
object | keys () |
| |
|
object | getValues () |
| |
|
object | getValues (Atom key) |
| |
|
object | values () |
| |
|
object | getEntries () |
| |
|
object | items () |
| |
| int | getNumEntries (Atom key) |
| | Returns the number of entries with the specified key. More...
|
| |
| int | removeEntries (Atom key) |
| | Removes all entries with the specified key from the map. More...
|
| |
| None | insertEntry (Atom key, Atom value) |
| | Inserts a new entry with specified key and value into the map. More...
|
| |
| int | __len__ () |
| | Returns the size (number of entries) of the map. More...
|
| |
| Atom | __getitem__ (Atom key) |
| | Returns a reference to the first value associated with the specified key. More...
|
| |
|
None | __setitem__ (Atom key, Atom value) |
| |
|
bool | __delitem__ (Atom key) |
| |
| int | __contains__ (Atom key) |
| | Returns the result of the membership test operation key in self. More...
|
| |
Data type for the storage and lookup of arbitrary atom to atom mappings.
Atoms mappings are stored as pairs of references to the mapped Chem.Atom objects. Mappings do not have to be unique and multiple mappings of a given atom to other atoms are possible. If a mapping entry for a particular atom does not exist, the methods AtomMapping.getValue() and AtomMapping.__getitem__() return None to indicate that the lookup of the mapped atom has failed.
◆ __init__()
| None CDPL.Chem.AtomMapping.__init__ |
( |
AtomMapping |
mapping | ) |
|
Initializes a copy of the AtomMapping instance mapping.
- Parameters
-
| mapping | The AtomMapping instance to copy. |
◆ getObjectID()
| int CDPL.Chem.AtomMapping.getObjectID |
( |
| ) |
|
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python AtomMapping 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 AtomMapping 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.
◆ getSize()
| int CDPL.Chem.AtomMapping.getSize |
( |
| ) |
|
Returns the size (number of entries) of the map.
- Returns
- The size of the map.
◆ isEmpty()
| bool CDPL.Chem.AtomMapping.isEmpty |
( |
| ) |
|
Tells whether the map is empty (getSize() == 0).
- Returns
True if the map is empty, and False otherwise.
◆ assign()
Replaces the current state of self with a copy of the state of the AtomMapping instance map.
- Parameters
-
| map | The AtomMapping instance to copy. |
- Returns
- self
◆ getValue() [1/2]
| Atom CDPL.Chem.AtomMapping.getValue |
( |
Atom |
key | ) |
|
Returns a reference to the first value associated with the specified key.
If the map contains the specified entry, a reference to the associated value is returned. If the map does not contain the entry and default values are enabled (that is, the template parameter AllowDefValues is True), a reference to a default constructed value object is returned. Otherwise, Base.ItemNotFound is thrown to indicate the error.
- Parameters
-
| key | The key associated with the requested value. |
- Returns
- A reference to the requested value.
- Exceptions
-
| Base.ItemNotFound | if AllowDefValues is False and the map does not contain an entry with the specified key. |
- See also
- getValue(const Key&) const
◆ getValue() [2/2]
| Atom CDPL.Chem.AtomMapping.getValue |
( |
Atom |
key, |
|
|
Atom |
def_value |
|
) |
| |
Returns a reference to the first value associated with the specified key, or the value given by the second argument if an entry with the given key does not exist.
If the map contains an entry with the specified key, a reference to the associated value is returned. If the map does not contain the entry, the second argument def_value is returned.
- Parameters
-
| key | The key associated with the requested value. |
| def_value | The value which is returned if the specified entry does not exist. |
- Returns
- A reference to the requested or default value.
◆ removeEntry()
| bool CDPL.Chem.AtomMapping.removeEntry |
( |
Atom |
key | ) |
|
Removes the first entry with the specified key from the map.
- Parameters
-
| key | The key specifying the entry to remove. |
◆ setEntry()
| None CDPL.Chem.AtomMapping.setEntry |
( |
Atom |
key, |
|
|
Atom |
value |
|
) |
| |
Replaces all entries with a key equivalent to key with a single copy of the key/value pair (key, value).
If no entries with a key equivalent to the specified key exist, setEntry(k, v) is equivalent to insertEntry(k, v).
- Parameters
-
| key | The key of the entries to replace. |
| value | The value associated with key. |
- Returns
- An iterator that points to the entry with a key that is equivalent to the specified key.
◆ getNumEntries()
| int CDPL.Chem.AtomMapping.getNumEntries |
( |
Atom |
key | ) |
|
Returns the number of entries with the specified key.
- Parameters
-
| key | The key of the entries to count. |
- Returns
- The number of entries with the specified key.
◆ removeEntries()
| int CDPL.Chem.AtomMapping.removeEntries |
( |
Atom |
key | ) |
|
Removes all entries with the specified key from the map.
- Parameters
-
| key | The key specifying the entries to remove. |
- Returns
- The number of removed entries.
◆ insertEntry()
| None CDPL.Chem.AtomMapping.insertEntry |
( |
Atom |
key, |
|
|
Atom |
value |
|
) |
| |
Inserts a new entry with specified key and value into the map.
- Parameters
-
| key | The key of the entry to insert. |
| value | The value associated with key |
- Returns
- An iterator pointing to the inserted entry.
◆ __len__()
| int CDPL.Chem.AtomMapping.__len__ |
( |
| ) |
|
Returns the size (number of entries) of the map.
- Returns
- The size of the map.
◆ __getitem__()
| Atom CDPL.Chem.AtomMapping.__getitem__ |
( |
Atom |
key | ) |
|
Returns a reference to the first value associated with the specified key.
The method is equivalent to getValue(const Key&) const.
- Parameters
-
| key | The key associated with the requested value. |
- Returns
- A reference to the requested value.
- Exceptions
-
| Base.ItemNotFound | if AllowDefValues is False and the map does not contain an entry with the specified key. |
- See also
- getValue(const Key&) const
◆ __contains__()
| int CDPL.Chem.AtomMapping.__contains__ |
( |
Atom |
key | ) |
|
Returns the result of the membership test operation key in self.
- Parameters
-
| key | The value to test for membership. |
- Returns
- The result of the membership test operation.