HxInterval Class¶
-
class
hexaly.optimizer.HxInterval¶ Value type for interval expressions. Such value is obtained with
HxExpression::valuewhen the expression is an interval.
Summary¶
HxInterval |
Constructor of HxInterval. |
is_present |
Returns true if the interval is present (non-void). |
is_void |
Returns true if the interval is void. |
is_degenerate |
Returns true if the interval is degenerate. |
start |
Returns the start of the interval. |
end |
Returns the end of the interval. |
count |
Returns the number of elements in the interval. |
contains |
Returns true if the interval contains the given value, false otherwise. |
__str__ |
Returns a string representation of this interval. |
__contains__ |
Operator overloading for HxInterval.contains(). |
__len__ |
Returns the number of elements in this interval (same result as HxInterval.count()). |
__iter__ |
Returns an iterator for the content of this interval. |
Instance methods¶
-
HxInterval.HxInterval()¶ Constructor of HxInterval. Returns a void interval.
Returns: Void interval. Return type: HxInterval
-
HxInterval.HxInterval(value) Constructor of HxInterval. Returns a degenerate interval of value
[value, value).Parameters: value – Start and end of the interval. Returns: Degenerate interval. Return type: HxInterval
-
HxInterval.HxInterval(start, end) Constructor of HxInterval. Returns an interval of value
[start, end). End must be greater (or equal) than start.Parameters: - start – Start of the interval.
- end – End of the interval.
Returns: An interval.
Return type: HxInterval
-
HxInterval.is_present()¶ Returns true if the interval is present (non-void). A void interval is an empty interval with no valid start or end bounds.
Returns: True if the interval is present. Return type: bool
-
HxInterval.is_void()¶ Returns true if the interval is void. A void interval is an empty interval with no valid start or end bounds.
Returns: True if the interval is void. Return type: bool
-
HxInterval.is_degenerate()¶ Returns true if the interval is degenerate. A degenerate interval is an interval with equal start and end bounds. It does not contain any element however.
Returns: True if the interval is degenerate. Return type: bool
-
HxInterval.start()¶ Returns the start of the interval. Cannot be called on a void interval as it does not have a valid start.
Returns: Start of the interval. Return type: int
-
HxInterval.end()¶ Returns the end of the interval. Cannot be called on a void interval as it does not have a valid end.
Returns: End of the interval. Return type: int
-
HxInterval.count()¶ Returns the number of elements in the interval. A void or degenerate interval does not contain any element.
Returns: Number of elements in the interval. Return type: int
-
HxInterval.contains(value)¶ Returns true if the interval contains the given value, false otherwise.
Parameters: value – Element whose presence in this interval is to be tested. Returns: True if the interval contains the value. Return type: bool
Special operators and methods¶
-
HxInterval.__str__()¶ Returns a string representation of this interval.
Returns: String representation of this interval. Return type: str
-
HxInterval.__contains__(value)¶ Operator overloading for
HxInterval.contains().Returns: True if the interval contains the value. Return type: bool
-
HxInterval.__len__()¶ Returns the number of elements in this interval (same result as
HxInterval.count()).Returns: Number of elements in the interval. Return type: int
-
HxInterval.__iter__()¶ Returns an iterator for the content of this interval.