tqec.templates.interval.Intervals
- class Intervals(intervals: list[Interval])[source]
A collection of
Interval
instances.This class stores a sorted list of mutually disjoint intervals and allow to manipulate them using union / intersection operations.
- Raises:
TQECException – at construction, if any of the provided intervals overlap.
Methods
__init__
(intervals)complement
()Get the complement of the interval, defined as R self.
contains
(value)Returns True if self contains the provided value, else False.
intersection
(other)Compute and return the intersection of self and other.
is_empty
()Returns True if self is the empty interval, else False.
union
(other)Compute and return the union of self and other.
Attributes
intervals