math.RangeSet Extends
Constructs a new RangeSet, which can store numeric ranges. Ranges are treated as half-closed: that is, they are exclusive of their end value [start, end). New ranges added to the set which overlap the values in one or more existing ranges will be merged.

Inheritance

Constructor

goog.math.RangeSet()

Instance Methods

Public Protected Private
__iterator__(opt_keys) !goog.iter.Iterator
Returns an iterator that iterates over the ranges in the RangeSet.
Arguments:
opt_keys : boolean=
Ignored for RangeSets.
Returns: !goog.iter.Iterator  An iterator over the values in the set.
code »
add(a)
Adds a range to the set. If the new range overlaps existing values, those ranges will be merged.
Arguments:
a : goog.math.Range
The range to add.
code »
clear()
Removes all values in the set.
code »
clone() !goog.math.RangeSet
No description.
Returns: !goog.math.RangeSet  A new RangeSet containing the same values as this one.
code »
contains(a) boolean
Determines whether a given range is in the set. Only succeeds if the entire range is available.
Arguments:
a : goog.math.Range
The query range.
Returns: boolean  Whether the entire requested range is set.
code »
containsValue(value) boolean
Determines whether a given value is set in the RangeSet.
Arguments:
value : number
The value to test.
Returns: boolean  Whether the given value is in the set.
code »
coveredLength() number
No description.
Returns: number  The sum of the lengths of ranges covered in the set.
code »
difference(set) !goog.math.RangeSet
Subtracts the ranges of another set from this one, returning the result as a new RangeSet.
Arguments:
set : !goog.math.RangeSet
The RangeSet to subtract.
Returns: !goog.math.RangeSet  A new RangeSet containing all values in this set minus the values of the input set.
code »
getBounds() goog.math.Range
No description.
Returns: goog.math.Range  The total range this set covers, ignoring any gaps between ranges.
code »
intersection(set) !goog.math.RangeSet
Intersects this RangeSet with another.
Arguments:
set : goog.math.RangeSet
The RangeSet to intersect with.
Returns: !goog.math.RangeSet  A new RangeSet containing all values set in both this and the input set.
code »
inverse(range) !goog.math.RangeSet
Creates an inverted slice of this set over the input range.
Arguments:
range : goog.math.Range
The range to copy into the slice.
Returns: !goog.math.RangeSet  A new RangeSet containing inverted values from the original over the input range.
code »
isEmpty() boolean
No description.
Returns: boolean  Whether any ranges are currently in the set.
code »
remove(a)
Removes a range of values from the set.
Arguments:
a : goog.math.Range
The range to remove.
code »
slice(range) !goog.math.RangeSet
Creates a subset of this set over the input range.
Arguments:
range : goog.math.Range
The range to copy into the slice.
Returns: !goog.math.RangeSet  A new RangeSet with a copy of the values in the input range.
code »
toString() string
No description.
Returns: string  A debug string in the form [[1, 5], [8, 9], [15, 30]].
code »
union(set) !goog.math.RangeSet
Returns the union of this RangeSet with another.
Arguments:
set : goog.math.RangeSet
Another RangeSet.
Returns: !goog.math.RangeSet  A new RangeSet containing all values from either set.
code »

Instance Properties

ranges_ :
A sorted list of ranges that represent the values in the set.
Code »

Static Methods

goog.math.RangeSet.equals(ab) boolean
Compares two sets for equality.
Arguments:
a : goog.math.RangeSet
A range set.
b : goog.math.RangeSet
A range set.
Returns: boolean  Whether both sets contain the same values.
code »

Package math

Package Reference