.. include:: ../../toolkit-substitutions

.. oe:namespace:: OEDataFlow

.. attention::

   |TWOLANGUAGE|

.. meta::
   :keywords: OERange


.. _OEDataFlow_OERange:

.. oe:class:: OERange

   .. oe:language:: c++

      .. oe:api::
   
         class OERange
   
      The :ref:`OERange <OEDataFlow_OERange>` class is used to represent
      numerical intervals that may be bounded or unbounded.

      .. oe:method:: Constructors
   
         .. oe:api::
   
            OERange()
   
         The default constructor initializes an empty (and invalid) range object.
   
         .. oe:api::
   
            OERange(const OERange& rhs)
   
         Copy constructor.
   
         .. oe:api::
   
            OERange(const std::optional<double>& low,
                    const std::optional<double>& high,
                    const std::string& incl = "[]")
   
         Constructs a range between *low* and *high*, with the provided inclusivity.
   
         low
           The low value of the range. For an unbounded interval,
           -std::numeric_limits<double>::infinity() can be specified.
   
         high
           The high value of the range. For an unbounded interval,
           std::numeric_limits<double>::infinity() can be specified.
   
         inclusivity
           Represents the inclusivity of *low* and *high* in the range. Allowed values are
   
           ============ ===============================
           inclusivity  Range value
           ============ ===============================
           "[]"         [low, high] or low <= x <= high
           "(]"         (low, high] or low < x <= high
           "[)"         [low, high) or low <= x < high
           "()"         (low, high) or low < x < high
           ============ ===============================
   
   .. oe:method:: operator=
      :language: c++

      .. oe:api::

         OERange & operator=(const OERange &)

      Assignment operator.

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

            bool operator==(const OERange& rhs) const

         Returns true if the lower, upper, and inclusivity values are all equal
         between the two OERange values.
   
      .. oe:method:: IsValid
   
         .. oe:api::

            bool IsValid() const

         Returns true if either of the low or high values is bounded.
   
   
      .. oe:method:: GetLow
   
         .. oe:api::

            double GetLow() const

         Returns the lower value of the range. This will return 
         -std::numeric_limits<double>::infinity() if the range is unbounded at
         the low end.
   
      .. oe:method:: GetHigh
   
         .. oe:api::

            double GetHigh() const

         Returns the upper value of the range. This will return 
         std::numeric_limits<double>::infinity() if the range is unbounded at
         the high end.
   
   
      .. oe:method:: GetInclusivityString
   
         .. oe:api::

            std::string GetInclusivityString() const

         Returns one of the four strings, "[]", "(]", "[)", or "()" representing
         the inclusivity of the range.
   
      .. oe:method:: IsUnboundedLow
   
         .. oe:api::

            bool IsUnboundedLow() const

         Returns true if this OERange object has -infinity as a lower value.
   
      .. oe:method:: IsUnboundedHigh
   
         .. oe:api::

            bool IsUnboundedHigh() const

         Returns true if this OERange object has infinity as an upper value.
   
   .. oe:language:: python

      .. oe:api::
   
         class OERange
   
      The :ref:`OERange <OEDataFlow_OERange>` class is used to represent
      numerical intervals that may be bounded or unbounded.
   
      .. ################################################################
         # Constructors
         ################################################################
   
      .. oe:method:: Constructors
   
         .. oe:api::
   
            OERange()
   
         The default constructor initializes an empty (and invalid) range object.
   
         .. oe:api::
   
            OERange(rhs: OERange)
   
         Copy constructor.
   
         .. oe:api::
   
            OERange(low: float, high: float, inclusivity: str = "[]")
   
         Constructs a range between *low* and *high*, with the provided inclusivity.
   
         low
           The low value of the range. For an unbounded interval,
           -math.inf can be specified.
   
         high
           The high value of the range. For an unbounded interval,
           math.inf can be specified.
   
         inclusivity
           Represents the inclusivity of *low* and *high* in the range. Allowed values are
   
           ============ ===============================
           inclusivity  Range value
           ============ ===============================
           "[]"         [low, high] or low <= x <= high
           "(]"         (low, high] or low < x <= high
           "[)"         [low, high) or low <= x < high
           "()"         (low, high) or low < x < high
           ============ ===============================
   
      .. oe:method:: __eq__
   
         .. oe:api::
   
            __eq__(rhs: OERange) -> bool
   
         Returns *True* if the lower, upper, and inclusivity values are all equal
         between the two OERange values.
   
      .. oe:method:: is_valid
   
         .. oe:api::
   
            is_valid() -> bool
   
         Returns *True* if either of the low or high values is bounded.
   
   
      .. oe:method:: get_low
   
         .. oe:api::
   
            get_low() -> float
   
         Returns the lower value of the range. This will return 
         -math.inf if the range is unbounded at the low end.
   
      .. oe:method:: get_high
   
         .. oe:api::
   
            get_high() -> float
   
         Returns the upper value of the range. This will return 
         math.inf if the range is unbounded at the high end.
   
   
      .. oe:method:: get_inclusivity_string
   
         .. oe:api::
   
            get_inclusivity_string() -> str
   
         Returns one of the four strings, "[]", "(]", "[)", or "()" representing
         the inclusivity of the range.
   
      .. oe:method:: is_unbounded_low
   
         .. oe:api::
   
            is_unbounded_low() -> bool
   
         Returns *True* if this OERange object has -infinity as a lower value.
   
      .. oe:method:: is_unbounded_high
   
         .. oe:api::
   
            is_unbounded_high() -> bool
   
         Returns *True* if this OERange object has infinity as an upper value.
   
