An immutable number range with min/max values.
Signature:
export default class IntRange implements Comparable<IntRange>
Implements: Comparable<IntRange>
The minimum and maximum values can use null
to represent "none".
Constructor | Modifiers | Description |
---|---|---|
(constructor)(min, max) | Constructor. |
Property | Modifiers | Type | Description |
---|---|---|---|
isSingleton | readonly |
boolean | Test if this range represents a singleton value, where the minimum and maximum values in the range are equal. |
length | readonly |
number | Get the number of values between min and max , inclusive. |
max | readonly |
number | null | Get the minimum value. |
min | readonly |
number | null | Get the minimum value. |
Method | Modifiers | Description |
---|---|---|
adjacentTo(o) | Test if this range is adjacent to (but not intersecting) a given range. | |
canMergeWith(o) | Test if this range could be merged with another range. Two ranges can be merged if they are either adjacent to or intersect with each other. |
|
compareTo(o) | Compares this object with the specified object for order. Unbounded ( |
|
contains(value) | Test if a value is within this range, inclusive. | |
containsAll(min, max) | Test if another range is completely within this range, inclusive. | |
containsRange(o) | Test if another range is completely within this range, inclusive. | |
delimiter(locale) | static |
Get a locale-specific range delimiter to use. |
description(bounds, r, options) | static |
Generate a description of a range. |
equals(obj) | Test for equality. This method tests if |
|
intersects(o) | Test if this range intersects with a given range. | |
mergeWith(o) | Merge this range with a given range, returning the merged range. | |
of(value) | static |
Create a singleton range, where the minimum and maximum values are equal. |
parseRange(value, bounds, options) | static |
Parse a range array of number strings into an IntRange . |
rangeOf(min, max) | static |
Create a range. |
toString() | Get a string representation. The format returned by this method is |