1from typing
import Union, Any
3from ids_peak_common
import exceptions
10 Represents an interval with lower and upper boundaries.
12 @ingroup ids_peak_common_python_types
15 def __init__(self, minimum: Union[int, float], maximum: Union[int, float]):
20 @param minimum: The lower boundary.
21 @param maximum: The upper boundary.
23 @exception OutOfRangeException: If maximum is less than minimum.
25 validate_parameter_types(minimum, maximum, accepted_types=(int, float))
28 "Maximum value has to be bigger than or equal to the minimum value"
34 def __eq__(self, other: Any) -> bool:
37 Check if two intervals are equal.
39 @param other: Another Interval object OR List of boundaries [minimum, maximum] OR Tuple of boundaries (minimum, maximum)
41 @return True if intervals are equal, False otherwise
43 if isinstance(other, Interval):
44 return is_equal(self.
_minimum, other._minimum)
and is_equal(self.
_maximum, other._maximum)
45 if isinstance(other, (list, tuple)):
48 return is_equal(self.
_minimum, other[0])
and is_equal(self.
_maximum, other[1])
51 def __ne__(self, other: Any) -> bool:
54 Check if two intervals are not equal.
56 @param other: Another Interval object OR List of boundaries [minimum, maximum] OR Tuple of boundaries (minimum, maximum)
58 @return True if intervals are not equal, False otherwise
60 return not self.
__eq__(other)
69 Returns the lower boundary of the interval.
77 Returns the upper boundary of the interval.
84 Returns a string representation of the Interval object.
86 @return String representation of the Interval object.
88 return f
"(minimum={self.minimum}, maximum={self.maximum})"
93 Return an unambiguous string of the Interval object.
95 return f
"{self.__class__.__name__}{str(self)}"
Represents an interval with lower and upper boundaries.
Union[int, float] maximum(self)
Returns the upper boundary of the interval.
Union[int, float] minimum(self)
Returns the lower boundary of the interval.
Union[int, float] _maximum
__init__(self, Union[int, float] minimum, Union[int, float] maximum)
Creates an interval.
Union[int, float] _minimum
bool __ne__(self, Any other)
Check if two intervals are not equal.
str __str__(self)
Returns a string representation of the Interval object.
str __repr__(self)
Return an unambiguous string of the Interval object.
bool __eq__(self, Any other)
Check if two intervals are equal.
Thrown when a parameter is outside the valid range.