The goog.math.Range Class

goog.math.Range(a, b)

A number range.

a {number}
One end of the range.
b {number}
The other end of the range.

.boundingRange(a, b)

Given two ranges on the same dimension, this returns a range that covers both ranges.

a {goog.math.Range}
A Range.
b {goog.math.Range}
A Range.
returns {!goog.math.Range}
A new Range representing the bounding range.

.clone()

returns {!goog.math.Range}
A clone of this Range.

.contains(a, b)

Given two ranges, returns true if the first range completely overlaps the second.

a {goog.math.Range}
The first Range.
b {goog.math.Range}
The second Range.
returns {boolean}
True if b is contained inside a, false otherwise.

.containsPoint(range, p)

Given a range and a point, returns true if the range contains the point.

range {goog.math.Range}
The range.
p {number}
The point.
returns {boolean}
True if p is contained inside range, false otherwise.

.end {number}

The highest value in the range.

.equals(a, b)

Compares ranges for equality.

a {goog.math.Range}
A Range.
b {goog.math.Range}
A Range.
returns {boolean}
True iff both the starts and the ends of the ranges are equal, or if both ranges are null.

.hasIntersection(a, b)

Given two ranges on the same dimension, determines whether they intersect.

a {goog.math.Range}
A Range.
b {goog.math.Range}
A Range.
returns {boolean}
Whether they intersect.

.intersection(a, b)

Given two ranges on the same dimension, this method returns the intersection of those ranges.

a {goog.math.Range}
A Range.
b {goog.math.Range}
A Range.
returns {goog.math.Range}
A new Range representing the intersection of two ranges, or null if there is no intersection. Ranges are assumed to include their end points, and the intersection can be a point.

.start {number}

The lowest value in the range.

.toString()

Returns a string representing the range.

returns {string}
In the form [-3.5, 8.13].