AutoArchive._infrastructure.utils.interval¶
Operations with interval of integers.
Modules¶
interval¶
Interval
class.
interval_element¶
IntervalElement
class.
- class AutoArchive._infrastructure.utils.interval.interval_element.IntervalElement(value: int, interval: Interval[int])[source]¶
Bases:
object
An element from a numeric interval.
It is possible to specify value outside of the defined interval. The behavior is undefined in this case.
- Parameters:
value – The number from
interval
.interval – The interval the
value
is from.
- remapTo(targetInterval: Interval[int])[source]¶
Returns new element which is this element remapped to a target interval.
Examples:
element = 5, self.__interval = <0, 10>, targetInterval = <0, 100> => 50 element = 9, self.__interval = <1, 9>, targetInterval = <1, 19> => 19
- Parameters:
targetInterval – Interval which this element shall be remapped to.
- Returns:
Element from the target interval
targetInterval
.
- property value: int¶
Value of the element.