.. oe:namespace:: OEBio

.. meta::
   :keywords: OEAltLocation, AltLocation


.. _OEBio_OEAltLocation:

.. oe:class:: OEAltLocation

   .. oe:api::


      class OEAltLocation

   This class represents `OEAltLocation`, an abstraction of a particular alternate location of an
   :ref:`OEAltGroup <OEBio_OEAltGroup>` in the molecule used to construct an :ref:`OEAltLocationFactory <OEBio_OEAltLocationFactory>`.


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

   ================================================================ ================================================================================
   :oe:meth:`GetLocation<OEBio::OEAltLocationFactory::GetLocation>` :oe:meth:`GetCurrentLocations<OEBio::OEAltLocationFactory::GetCurrentLocations>`
   ================================================================ ================================================================================

   The following :ref:`OEAltGroup <OEBio_OEAltGroup>` method returns an :ref:`OEAltLocation <OEBio_OEAltLocation>` iterator:

   ======================================================== =
   :oe:meth:`GetLocations<OEBio::OEAltGroup::GetLocations>`  
   ======================================================== =

   The following :ref:`OEAltLocationFactory <OEBio_OEAltLocationFactory>` methods take an :ref:`OEAltLocation <OEBio_OEAltLocation>`:

   ========================================================================== ====================================================== ============================================================== ==========================================================
   :oe:meth:`GetLocationCodes<OEBio::OEAltLocationFactory::GetLocationCodes>` :oe:meth:`SetAlt<OEBio::OEAltLocationFactory::SetAlt>` :oe:meth:`MakeAltMol<OEBio::OEAltLocationFactory::MakeAltMol>` :oe:meth:`GetGroup<OEBio::OEAltLocationFactory::GetGroup>`
   ========================================================================== ====================================================== ============================================================== ==========================================================

   .. oe:method:: Constructors

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

         .. oe:api::

            OEAltLocation()
            OEAltLocation(const OEAltLocation& loc)
            OEAltLocation(int grpID, int locID, unsigned int numLocs)

      .. oe:language:: python

         .. oe:api:: python

            OEAltLocation() -> OEAltLocation
            OEAltLocation(grpID: int, locID: int, numLocs: int) -> OEAltLocation
            OEAltLocation(loc: OEAltLocation) -> OEAltLocation

      Default, copy and initialization constructors.

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

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

      If a group ID, a location ID and the total number of locations in the group is supplied,
      an object is constructed that represents the specified location in the specified group.

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

      .. oe:api::

         OEAltLocation &operator=(const OEAltLocation &loc)

      Assignment -- sets this location 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 location.
      Returns ``false`` if the location identifier is out of range.

   .. 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 the :ref:`OEAltGroup <OEBio_OEAltGroup>` that contains this location.
      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 alternate locations in the :ref:`OEAltGroup <OEBio_OEAltGroup>` that contains this location.

   .. oe:method:: GetLocationID

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

         .. oe:api::

            int GetLocationID() const

      .. oe:language:: python

         .. oe:api:: python

            GetLocationID() -> int

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

   .. oe:method:: SetLocationID

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

         .. oe:api::

            OEAltLocation& SetLocationID(int newLoc)

      .. oe:language:: python

         .. oe:api:: python

            SetLocationID(newLoc: int) -> OEAltLocation

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