.. oe:namespace:: OEBio

.. meta::
   :keywords: OEAltGroup, AltGroup


.. _OEBio_OEAltGroup:

.. oe:class:: OEAltGroup

   .. oe:api::

      class OEAltGroup

   This class represents `OEAltGroup`, an abstraction of a particular alternate location group in a molecule
   managed by an :ref:`OEAltLocationFactory <OEBio_OEAltLocationFactory>`. It can be thought of as a collection of
   :ref:`OEAltLocation <OEBio_OEAltLocation>` objects, each referring to a specific set of atomic positions.

   The following :ref:`OEAltLocationFactory <OEBio_OEAltLocationFactory>` methods return an :ref:`OEAltGroup <OEBio_OEAltGroup>` or the corresponding iterator:

   ========================================================== ============================================================ ==========================================================
   :oe:meth:`GetGroup<OEBio::OEAltLocationFactory::GetGroup>` :oe:meth:`GetGroups<OEBio::OEAltLocationFactory::GetGroups>` :oe:meth:`GetGroup<OEBio::OEAltLocationFactory::GetGroup>`
   ========================================================== ============================================================ ==========================================================

   The following :ref:`OEAltLocationFactory <OEBio_OEAltLocationFactory>` methods take an :ref:`OEAltGroup <OEBio_OEAltGroup>`:

   ========================================================================== ================================================================ ================================================================================
   :oe:meth:`GetLocationCodes<OEBio::OEAltLocationFactory::GetLocationCodes>` :oe:meth:`GetAltAtoms<OEBio::OEAltLocationFactory::GetAltAtoms>` :oe:meth:`GetCurrentLocations<OEBio::OEAltLocationFactory::GetCurrentLocations>`
   ========================================================================== ================================================================ ================================================================================

   .. oe:method:: Constructors

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

         .. oe:api::

            OEAltGroup()
            OEAltGroup(const OEAltGroup& grp)
            OEAltGroup(const unsigned int* counts, unsigned int numGrps)

      .. oe:language:: python

         .. oe:api:: python

            OEAltGroup() -> OEAltGroup
            OEAltGroup(counts: int) -> OEAltGroup
            OEAltGroup(grp: OEAltGroup) -> OEAltGroup

      Default, copy and initialization constructors.

      If no arguments are supplied, the :oe:cls:`OEAltGroup<OEBio::OEAltGroup>` is uninitialized
      and will return ``false`` when :oe:meth:`operator bool<OEBio::OEAltGroup::operator bool>` is called.

      If an :oe:cls:`OEAltGroup<OEBio::OEAltGroup>` is supplied, the constructed object is identical to the input.

      If an array of location counts is supplied along with the total number of groups (the size of the array),
      an object is constructed that represents the first of these groups (and can represent any of these groups).

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

      .. oe:api::

         OEAltGroup &operator=(const OEAltGroup &grp)

      Assignment -- sets this group to be identical to the input.

      Assignment operator.


   .. oe:method:: operator bool

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

         .. oe:api::

            operator bool() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Returns ``true`` if the object refers to an actual group.
      Returns ``false`` if the group identifier is out of range.

   .. oe:method:: GetGroupCount

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

         .. oe:api::

            unsigned int GetGroupCount() const

      .. oe:language:: python

         .. oe:api:: python

            GetGroupCount() -> int

      Returns the total number of alternate location groups found by the corresponding :ref:`OEAltLocationFactory <OEBio_OEAltLocationFactory>`.

   .. oe:method:: GetGroupID

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

         .. oe:api::

            int GetGroupID() const

      .. oe:language:: python

         .. oe:api:: python

            GetGroupID() -> int

      Returns an integer that identifies this alternate location group.
      A negative number indicates the object does not refer to an actual alternate location group.

   .. oe:method:: GetLocationCount

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

         .. oe:api::

            unsigned int GetLocationCount() const

      .. oe:language:: python

         .. oe:api:: python

            GetLocationCount() -> int

      Returns the total number of :oe:cls:`OEAltLocations<OEBio::OEAltLocation>` in this group.

   .. oe:method:: GetLocations

      .. oe:api::

         OESystem::OEIterBase<const OEAltLocation> *GetLocations() const

      Returns an iterator over all :oe:cls:`OEAltLocations<OEBio::OEAltLocation>` in this group.

   .. oe:method:: SetGroupID

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

         .. oe:api::

            OEAltGroup& SetGroupID(int newGrp)

      .. oe:language:: python

         .. oe:api:: python

            SetGroupID(newGrp: int) -> OEAltGroup

      Changes the group identifier for this group. If the identifier is out of range,
      :oe:meth:`operator bool<OEBio::OEAltGroup::operator bool>` will return ``false``.
