OERange

class OERange

The OERange class is used to represent numerical intervals that may be bounded or unbounded.

Constructors

OERange()

The default constructor initializes an empty (and invalid) range object.

OERange(rhs: OERange)

Copy constructor.

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

__eq__

__eq__(rhs: OERange) -> bool

Returns True if the lower, upper, and inclusivity values are all equal between the two OERange values.

is_valid

is_valid() -> bool

Returns True if either of the low or high values is bounded.

get_low

get_low() -> float

Returns the lower value of the range. This will return -math.inf if the range is unbounded at the low end.

get_high

get_high() -> float

Returns the upper value of the range. This will return math.inf if the range is unbounded at the high end.

get_inclusivity_string

get_inclusivity_string() -> str

Returns one of the four strings, “[]”, “(]”, “[)”, or “()” representing the inclusivity of the range.

is_unbounded_low

is_unbounded_low() -> bool

Returns True if this OERange object has -infinity as a lower value.

is_unbounded_high

is_unbounded_high() -> bool

Returns True if this OERange object has infinity as an upper value.