tqec.interval.Interval#

class Interval(start: float | int, end: float | int, start_excluded: bool = False, end_excluded: bool = True)[source]#

A subset of the mathematical space representing real numbers: R.

This class represents the mathematical object called interval. It stores two floating-point numbers representing the bounds of the interval as well as two booleans (one for each bound) to know if the corresponding bound is included in the interval or excluded from it.

Raises:
  • TQECException – if any bound is NaN.

  • TQECException – if the provided start value is strictly larger than the provided end value.

__init__(start: float | int, end: float | int, start_excluded: bool = False, end_excluded: bool = True) None#

Methods

__init__(start, end[, start_excluded, ...])

contains(value)

Returns True if self contains the provided value, else False.

intersection(other)

Compute and return the intersection of self and other.

is_disjoint(other)

Returns True if self does not overlap with the provided interval, else False.

is_empty()

Returns True if self is the empty interval, else False.

iter_integers()

overlaps_with(other)

Returns True if self overlaps with the provided interval, else False.

Attributes

end_excluded

start_excluded

start

end