/** * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal */ declare namespace Interval { const Empty: Interval; const ofSingleton: (value: T) => Interval; /** Create interval from range [min, max] */ const ofRange: (min: T, max: T) => Interval; /** Create interval from bounds [start, end), i.e. [start, end - 1] */ const ofBounds: (start: T, end: T) => Interval; /** Create interval from length [0, length), i.e. [0, length - 1] */ const ofLength: (length: T) => Interval; const is: (v: any) => v is Interval; /** Test if a value is within the bounds of the interval */ const has: (interval: Interval, x: T) => boolean; /** Returns the index of `x` in `set` or -1 if not found. */ const indexOf: (interval: Interval, x: T) => number; const getAt: (interval: Interval, i: number) => T; /** Start value of the Interval, same as min value */ const start: (interval: Interval) => T; /** End value of the Interval, same as max + 1 */ const end: (interval: Interval) => T; /** Min value of the Interval, same as start value */ const min: (interval: Interval) => T; /** Max value of the Interval, same as end - 1 */ const max: (interval: Interval) => T; /** Number of values in the interval */ const size: (interval: Interval) => number; /** Hash code describing the interval */ const hashCode: (interval: Interval) => number; /** String representation of the interval */ const toString: (interval: Interval) => string; /** Test if two intervals are identical */ const areEqual: (a: Interval, b: Interval) => boolean; /** Test if two intervals are intersecting, i.e. their bounds overlap */ const areIntersecting: (a: Interval, b: Interval) => boolean; /** Test if interval b is fully included in interval a */ const isSubInterval: (a: Interval, b: Interval) => boolean; const findPredecessorIndex: (interval: Interval, x: T) => number; const findPredecessorIndexInInterval: (interval: Interval, x: T, bounds: Interval) => number; const findRange: (interval: Interval, min: T, max: T) => Interval; /** Size of the intersection of the two intervals */ const intersectionSize: (a: Interval, b: Interval) => number; /** Get a new interval that is the intersection of the two intervals */ const intersect: (a: Interval, b: Interval) => Interval; /** Get new interval that is shifted by the given offset */ const offset: (int: Interval, offset: number) => Interval; } /** Interval describing a range [min, max] of values */ interface Interval { '@type': 'int-interval'; } export { Interval };