/** * The `Interval1D` class represents a one-dimensional interval. * The interval is closed—it contains both endpoints. * Intervals are immutable: their values cannot be changed after they are created. * The class `Interval1D` includes methods for checking whether * an interval contains a point and determining whether two intervals intersect. *
* For additional documentation, * see Section 1.2 of * Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne. */ export default class Interval1D { private readonly _min; private readonly _max; constructor(min: number, max: number); /** * Returns the length of this interval. * * @return the length of this interval (max - min) */ length(): number; /** * Returns true if this interval contains the specified value. * * @param x the value * @return true if this interval contains the value x; * false otherwise */ contains(x: number): boolean; /** * Returns true if this interval intersects the specified interval. * * @param that the other interval * @return true if this interval intersects the argument interval; * false otherwise */ intersects(that: Interval1D): boolean; min(): number; max(): number; draw(): void; }