.. oe:namespace:: OEChem

.. meta::
   :keywords: OEMatch, Match


.. _OEChem_OEMatch:

.. oe:class:: OEMatch

   .. oe:api::

      class OEMatch : public OEMatchBase

   This class represents `OEMatch`.

   The :ref:`OEMatch <OEChem_OEMatch>` class is a concrete instance of the
   :ref:`OEMatchBase <OEChem_OEMatchBase>` abstract base class.
   The purpose of an :ref:`OEMatch <OEChem_OEMatch>` object is to represent a
   pairwise correspondence between atoms and/or bonds in two different
   molecules. The correspondences are normally generated as the result
   of graph matching operations such as subgraph isomorphism
   determination, maximal common subgraph search, or supergraph
   search.

   The following methods are publicly inherited from :ref:`OEMatchBase <OEChem_OEMatchBase>`:

   =============================================================== ================================================================ ===============================================================
   :oe:meth:`operator bool<OEChem::OEMatchBase::operator bool>`    :oe:meth:`GetBonds<OEChem::OEMatchBase::GetBonds>`               :oe:meth:`GetTargetBonds<OEChem::OEMatchBase::GetTargetBonds>` 
   :oe:meth:`Clear<OEChem::OEMatchBase::Clear>`                    :oe:meth:`GetPatternAtoms<OEChem::OEMatchBase::GetPatternAtoms>` :oe:meth:`IsValid<OEChem::OEMatchBase::IsValid>`               
   :oe:meth:`CreateCopy<OEChem::OEMatchBase::CreateCopy>`          :oe:meth:`GetPatternBonds<OEChem::OEMatchBase::GetPatternBonds>` :oe:meth:`NumAtoms<OEChem::OEMatchBase::NumAtoms>`             
   :oe:meth:`GetAtoms<OEChem::OEMatchBase::GetAtoms>`              :oe:meth:`GetTargetAtoms<OEChem::OEMatchBase::GetTargetAtoms>`   :oe:meth:`NumBonds<OEChem::OEMatchBase::NumBonds>`             
   =============================================================== ================================================================ ===============================================================

   The following methods are publicly inherited from :ref:`OERoleSet <OESystem_OERoleSet>`:

   ======================================================= ======================================================= =======================================================
   :oe:meth:`AddRole<OESystem::OERoleSet::AddRole>`        :oe:meth:`GetRoles<OESystem::OERoleSet::GetRoles>`                                                             
   :oe:meth:`ClearRoles<OESystem::OERoleSet::ClearRoles>`  :oe:meth:`HasRole<OESystem::OERoleSet::HasRole>`                                                               
   :oe:meth:`DeleteRole<OESystem::OERoleSet::DeleteRole>`  :oe:meth:`NumRoles<OESystem::OERoleSet::NumRoles>`                                                             
   ======================================================= ======================================================= =======================================================

   .. oe:method:: Constructors

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEMatch()

      .. oe:language:: python

         .. oe:api:: python

            OEMatch() -> OEMatch

      Default constructor.

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEMatch(const OEMatch &)
            OEMatch(const OEMatchBase &)

      .. oe:language:: python

         .. oe:api:: python

            OEMatch(arg2: OEMatch) -> OEMatch
            OEMatch(arg2: OEMatchBase) -> OEMatch

      Copy constructor.

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEMatch(const std::vector<OEMatchPair<OEAtomBase> > &)

      .. oe:language:: python

         .. oe:api:: python

            OEMatch(arg2: List[OEMatchPair[OEAtomBase]]) -> OEMatch

      Constructors an :ref:`OEMatch <OEChem_OEMatch>` object and initializes
      it by making a copy of the passed vector of
      :ref:`OEMatchPair <OEChem_OEMatchPair>` objects which contain atom to atom
      mappings.

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEMatch(const std::vector<OEMatchPair<OEBondBase> > &)

      .. oe:language:: python

         .. oe:api:: python

            OEMatch(arg2: List[OEMatchPair[OEBondBase]]) -> OEMatch

      Constructors an :ref:`OEMatch <OEChem_OEMatch>` object and initializes
      it by making a copy of the passed vector of
      :ref:`OEMatchPair <OEChem_OEMatchPair>` objects which contain bond to bond
      mappings.

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEMatch(const std::vector<OEMatchPair<OEAtomBase> > &,
                    const std::vector<OEMatchPair<OEBondBase> > &)

      .. oe:language:: python

         .. oe:api:: python

            OEMatch(arg2: List[OEMatchPair[OEAtomBase]],
                    arg3: List[OEMatchPair[OEBondBase]]) -> OEMatch


      Constructors an :ref:`OEMatch <OEChem_OEMatch>` object and initializes
      it by making a copy of the passed vectors of
      :ref:`OEMatchPair <OEChem_OEMatchPair>` objects which contain and atom to atom and
      bond to bond mappings.

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEMatch(std::vector<OEMatchPair<OEAtomBase> > *,
                    std::vector<OEMatchPair<OEBondBase> > *)

      .. oe:language:: python

         .. oe:api:: python

            OEMatch(arg2: List[OEMatchPair[OEAtomBase]],
                    arg3: List[OEMatchPair[OEBondBase]]) -> OEMatch


   .. oe:method:: operator=
      :language: c++

      .. oe:api::

         const OEMatch &operator=(const OEMatch &rhs)

      Assignment operator that copies the data of the 'rhs' :ref:`OEMatch <OEChem_OEMatch>` object
      into the right-hand side :ref:`OEMatch <OEChem_OEMatch>` object.

      .. oe:api::

         const OEMatch &operator=(const OEMatchBase &rhs)

      Assignment operator that copies the data of the 'rhs' :ref:`OEMatchBase <OEChem_OEMatchBase>` object
      into the right-hand side :ref:`OEMatch <OEChem_OEMatch>` object.

   .. oe:method: operator new

      .. oe:api::

         void *operator new(size_t)
         void *operator new(size_t, void *here)

   .. oe:method: operator delete

      .. oe:api::

         void operator delete(void *ptr)
         void operator delete(void *ptr, size_t)

      Assignment operator.


   .. oe:method:: AddPair

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool AddPair(const OEBondBase *, const OEBondBase *)

      .. oe:language:: python

         .. oe:api:: python

            AddPair(arg2: OEBondBase, arg3: OEBondBase) -> bool

      Adds a pair of bonds (:ref:`OEBondBase <OEChem_OEBondBase>`) to the
      :ref:`OEMatch <OEChem_OEMatch>` object. Returns ``true`` if the bonds
      are successfully added. Returns ``false`` and throws a warning
      if the bonds being added do not belong to the same parent
      molecule as previously added bonds.

      .. oe:language:: c++ java csharp

         .. oe:api::

            bool AddPair(const OEAtomBase *, const OEAtomBase *)

      .. oe:language:: python

         .. oe:api:: python

            AddPair(arg2: OEAtomBase, arg3: OEAtomBase) -> bool

      Adds a pair of atoms (:ref:`OEAtomBase <OEChem_OEAtomBase>`) to the
      :ref:`OEMatch <OEChem_OEMatch>` object. Returns ``true`` if the atoms
      are successfully added. Returns ``false`` and throws a warning
      if the atoms being added do not belong to the same parent
      molecule as previously added atoms.

   .. seealso::

      .. oe:language:: c++

         * Example program :ref:`smartsalign.cpp<section_example_oechem_smartsalign>`

      .. oe:language:: python

         * Example program :ref:`smartsalign.py<section_example_oechem_smartsalign>`

      .. oe:language:: java

         * Example program :ref:`SMARTSAlign.java<section_example_oechem_smartsalign>`

      .. oe:language:: csharp

         * Example program :ref:`SMARTSAlign.cs<section_example_oechem_smartsalign>`

   .. oe:method:: Clear

      .. oe:language:: c++ java csharp

         .. oe:api::

            void Clear()

      .. oe:language:: python

         .. oe:api:: python

            Clear() -> None

      Removes all atom and bond of pairs from the
      :oe:cls:`OEMatch<OEChem::OEMatch>` and clears the :ref:`OERoleSet <OESystem_OERoleSet>`.

   .. oe:method:: CreateCopy

      .. oe:language:: c++ java csharp

         .. oe:api::

            OESystem::OEMatchBase* CreateCopy() const

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OEMatchBase

      Deep copy constructor that returns a copy of the object.
      The memory for the returned object derived from :ref:`OEMatchBase <OEChem_OEMatchBase>`
      is dynamically allocated and owned by the caller.

      .. oe:language:: c++

         The returned copy should be deallocated using C++
         delete operator in order to prevent a memory leak.

   .. oe:method:: GetAtoms

      .. oe:language:: c++ java csharp

         .. oe:api::

            OESystem::OEIterBase<OEMatchPair<OEAtomBase> >* GetAtoms() const

      .. oe:language:: python

         .. oe:api:: python

            GetAtoms() -> Iterable[OEMatchPair[OEAtomBase]]

      Returns an iterator over
      :oe:cls:`OEChem::OEMatchPairs<OEChem::OEMatchPair>` which contain
      the atom to atom correspondences in the
      :ref:`OEMatchBase <OEChem_OEMatchBase>` object.
      The returned :ref:`OEIterBase <OESystem_OEIterBase>` pointer should be
      assigned to an :ref:`OEIter <OESystem_OEIter>` object to prevent
      memory leaks.

   .. oe:method:: GetBonds

      .. oe:language:: c++ java csharp

         .. oe:api::

            OESystem::OEIterBase<OEMatchPair<OEBondBase> >* GetBonds() const

      .. oe:language:: python

         .. oe:api:: python

            GetBonds() -> Iterable[OEMatchPair[OEBondBase]]

      Returns an iterator over
      :oe:cls:`OEChem::OEMatchPairs<OEChem::OEMatchPair>` which contain
      the bond to bond correspondences in the
      :ref:`OEMatchBase <OEChem_OEMatchBase>` object.
      The returned :ref:`OEIterBase <OESystem_OEIterBase>` pointer should be
      assigned to an :ref:`OEIter <OESystem_OEIter>` object to prevent
      memory leaks.

   .. oe:method:: NumAtoms

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int NumAtoms() const

      .. oe:language:: python

         .. oe:api:: python

            NumAtoms() -> int

      Returns the number of atom equivalences in the
      :ref:`OEMatch <OEChem_OEMatch>` object.

   .. oe:method:: NumBonds

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned int NumBonds() const

      .. oe:language:: python

         .. oe:api:: python

            NumBonds() -> int

      Returns the number of bond equivalences in the
      :ref:`OEMatch <OEChem_OEMatch>` object.
