Chemical Data Processing Library Python API - Version 1.1.1
|
A data type for the storage and lookup of arbitrary feature to feature mappings. More...
Public Member Functions | |
None | __init__ () |
Creates an empty map. | |
None | __init__ (FeatureMapping mapping) |
Initializes a copy of the FeatureMapping 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. | |
FeatureMapping | assign (FeatureMapping map) |
Replaces the current state of self with a copy of the state of the FeatureMapping instance map. More... | |
Feature | getValue (Feature key) |
Returns a reference to the first value associated with the specified key. More... | |
Feature | getValue (Feature key, Feature 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 (Feature key) |
Removes the first entry with the specified key from the map. More... | |
None | setEntry (Feature key, Feature 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 (Feature key) |
object | values () |
object | getEntries () |
object | items () |
int | getNumEntries (Feature key) |
Returns the number of entries with the specified key. More... | |
int | removeEntries (Feature key) |
Removes all entries with the specified key from the map. More... | |
None | insertEntry (Feature key, Feature value) |
Inserts a new entry with specified key and value into the map. More... | |
int | __len__ () |
Feature | __getitem__ (Feature key) |
None | __setitem__ (Feature key, Feature value) |
bool | __delitem__ (Feature key) |
int | __contains__ (Feature key) |
Returns the result of the membership test operation key in self . More... | |
Properties | |
objectID = property(getObjectID) | |
size = property(getSize) | |
A data type for the storage and lookup of arbitrary feature to feature mappings.
Features mappings are stored as pairs of references to the mapped Pharm.Feature objects. Mappings do not have to be unique and multiple mappings of a given feature to other features are possible. If a mapping entry for a particular feature does not exist, the methods FeatureMapping.getValue() and FeatureMapping.operator[]() return a None reference to indicate that the lookup of the mapped feature has failed.
None CDPL.Pharm.FeatureMapping.__init__ | ( | FeatureMapping | mapping | ) |
Initializes a copy of the FeatureMapping instance mapping.
mapping | The FeatureMapping instance to copy. |
int CDPL.Pharm.FeatureMapping.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python FeatureMapping 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 FeatureMapping 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()
.
Reimplemented in CDPL.Pharm.SpatialFeatureMapping.
int CDPL.Pharm.FeatureMapping.getSize | ( | ) |
Returns the size (number of entries) of the map.
bool CDPL.Pharm.FeatureMapping.isEmpty | ( | ) |
Tells whether the map is empty (getSize() == 0).
True
if the map is empty, and False
otherwise. FeatureMapping CDPL.Pharm.FeatureMapping.assign | ( | FeatureMapping | map | ) |
Replaces the current state of self with a copy of the state of the FeatureMapping instance map.
map | The FeatureMapping instance to copy. |
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.
key | The key associated with the requested value. |
Base.ItemNotFound | if AllowDefValues is False and the map does not contain an entry with the specified key. |
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.
key | The key associated with the requested value. |
def_value | The value which is returned if the specified entry does not exist. |
bool CDPL.Pharm.FeatureMapping.removeEntry | ( | Feature | key | ) |
Removes the first entry with the specified key from the map.
key | The key specifying the entry to remove. |
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)
.
key | The key of the entries to replace. |
value | The value associated with key. |
object CDPL.Pharm.FeatureMapping.getKeys | ( | ) |
object CDPL.Pharm.FeatureMapping.keys | ( | ) |
object CDPL.Pharm.FeatureMapping.getValues | ( | ) |
object CDPL.Pharm.FeatureMapping.getValues | ( | Feature | key | ) |
key |
object CDPL.Pharm.FeatureMapping.values | ( | ) |
object CDPL.Pharm.FeatureMapping.getEntries | ( | ) |
object CDPL.Pharm.FeatureMapping.items | ( | ) |
int CDPL.Pharm.FeatureMapping.getNumEntries | ( | Feature | key | ) |
Returns the number of entries with the specified key.
key | The key of the entries to count. |
int CDPL.Pharm.FeatureMapping.removeEntries | ( | Feature | key | ) |
Removes all entries with the specified key from the map.
key | The key specifying the entries to remove. |
Inserts a new entry with specified key and value into the map.
key | The key of the entry to insert. |
value | The value associated with key |
int CDPL.Pharm.FeatureMapping.__len__ | ( | ) |
bool CDPL.Pharm.FeatureMapping.__delitem__ | ( | Feature | key | ) |
key |
int CDPL.Pharm.FeatureMapping.__contains__ | ( | Feature | key | ) |
Returns the result of the membership test operation key in self
.
key | The value to test for membership. |