Interval

Interval

Interval is a pair of numbers or a pair of any comparable objects on which may be defined predicates *equal*, *less* and method *max(p1, p1)* that returns maximum in a pair. When interval is an object rather than pair of numbers, this object should have properties *low*, *high*, *max* and implement methods *less_than(), equal_to(), intersect(), not_intersect(), clone(), output()*. Two static methods *comparable_max(), comparable_less_than()* define how to compare values in pair.
This interface is described in typescript definition file *index.d.ts* Axis aligned rectangle is an example of such interval. We may look at rectangle as an interval between its low left and top right corners. See **Box** class in [flatten-js](https://github.com/alexbol99/flatten-js) library as the example of Interval interface implementation

Constructor

new Interval(low, high)

Accept two comparable values and creates new instance of interval Predicate Interval.comparable_less(low, high) supposed to return true on these values
Source:
Parameters:
Name Type Description
low
high

Members

max

Propery max returns clone of this interval
Source:

Methods

(static) comparable_less_than(val1, val2) → {boolean}

Predicate returns true if first value less than second value
Source:
Parameters:
Name Type Description
val1
val2
Returns:
Type:
boolean

(static) comparable_max(interval1, interval2) → {Interval}

Function returns maximum between two comparable values
Source:
Parameters:
Name Type Description
interval1
interval2
Returns:
Type:
Interval

clone() → {Interval}

Clone interval
Source:
Returns:
Type:
Interval

equal_to(other_interval) → {boolean}

Predicate returns true is this interval equals to other interval
Source:
Parameters:
Name Type Description
other_interval
Returns:
Type:
boolean

intersect(other_interval) → {boolean}

Predicate returns true if this interval intersects other interval
Source:
Parameters:
Name Type Description
other_interval
Returns:
Type:
boolean

less_than(other_interval) → {boolean}

Predicate returns true is this interval less than other interval
Source:
Parameters:
Name Type Description
other_interval
Returns:
Type:
boolean

merge(interval) → {Interval}

Returns new interval merged with other interval
Source:
Parameters:
Name Type Description
interval Interval Other interval to merge with
Returns:
Type:
Interval

not_intersect(other_interval) → {boolean}

Predicate returns true if this interval does not intersect other interval
Source:
Parameters:
Name Type Description
other_interval
Returns:
Type:
boolean

output()

Returns how key should return
Source: