Represents a range of values, from a lower bound to an upper bound (the lower bound must be less than or equal to the upper bound).
new Range(num lowerBound, num upperBound) #
Creates a new instance. It is required that lowerBound is less than or equal to upperBound.
final num length #
Returns the length of the range.
num lowerBound #
The lower bound of the range.
num upperBound #
The upper bound of the range.
bool contains(num value) #
true if the range contains the specified
value (inclusive of
bool intersects(num bound1, num bound2) #
true if this range intersects with the range specified by
num peggedValue(num value) #
Pegs the value to a point in the range. If the value is already within the range, then that value is returned. Otherwise, the upper or lower bound of the range is returned, whichever is closer.
num percent(num value) #
Converts the value to a percentage along the range. Note that percentages are specified in the range 0.0 to 1.0 (for example, 0.25 is twenty five percent).
String toString() #
Returns a string representation of this instance, primarily for debugging purposes.
num value(num percentage) #
Converts a percentage into a value along the range. Note that percentages are specified in the range 0.0 to 1.0 (for example, 0.25 is twenty five percent).