Package gov.nasa.jpl.aerie.scheduler
Class Range<T extends Comparable<T>>
java.lang.Object
gov.nasa.jpl.aerie.scheduler.Range<T>
- All Implemented Interfaces:
Comparable<Range<T>>
represents an inclusive interval of partially ordered values
the semantics of a range include both of its endpoints, as well as any
value that compares greater than or equal to the minimum and less than or
equal to the maximum
ranges may have the same minimum and maximum value, in which case it admits
only values that compare equal to those bounds
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
boolean
determines if this range admits the queried value the range inclusively admits values equal to its upper and lower bounds as well as any value between the tworeturn a range enveloping the two passed rangesboolean
boolean
equalsRange
(Range<T> otherRange) fetch the inclusive upper bound of the rangefetch the inclusive lower bound of the rangeint
hashCode()
Returns new range from intersection with other rangeboolean
isAdjacent
(Range<T> otherRange) boolean
boolean
boolean
static <T extends Comparable<T>>
Range<T> of
(T minimum, T maximum) factory creates a new range with given minimum and maximum bounds the range admits both endpoints and any value between them the minimum and maximum may be the same valuesubsetFullyContained
(List<Range<T>> windows) toString()
gives a simple human-readable reprsentation of the closed interval range
-
Constructor Details
-
Range
creates a new range that reprsents only a single allowed value- Parameters:
singleton
- IN the single value that is admitted by the new range
-
Range
creates a new range with given minimum and maximum bounds the range admits both endpoints and any value between them the minimum and maximum may be the same value- Parameters:
minimum
- IN the inclusive minimum bound of the new rangemaximum
- IN the inclusive maximum bound of the new range
-
-
Method Details
-
isSingleton
public boolean isSingleton() -
of
factory creates a new range with given minimum and maximum bounds the range admits both endpoints and any value between them the minimum and maximum may be the same value- Parameters:
minimum
- IN the inclusive minimum bound of the new rangemaximum
- IN the inclusive maximum bound of the new range
-
getMinimum
fetch the inclusive lower bound of the range- Returns:
- the inclusive lower bound of the range
-
getMaximum
fetch the inclusive upper bound of the range- Returns:
- the inclusive upper bound of the range
-
contains
determines if this range admits the queried value the range inclusively admits values equal to its upper and lower bounds as well as any value between the two- Parameters:
probe
- IN the value to test if it is in the range- Returns:
- true iff the queried value is within the inclusive range, false otherwise
-
subsetFullyContained
-
intersect
Returns new range from intersection with other range- Parameters:
otherRange
- range to be intersected with- Returns:
- a new range from intersection with otherRange
-
subtract
-
isBefore
-
isAfter
-
isAdjacent
-
envelop
return a range enveloping the two passed ranges- Parameters:
range1
- the first range to considerrange2
- the second range to consider- Returns:
- a range enveloping the two passed ranges
-
contains
-
hashCode
public int hashCode() -
equals
-
equalsRange
-
toString
gives a simple human-readable reprsentation of the closed interval range -
compareTo
- Specified by:
compareTo
in interfaceComparable<T extends Comparable<T>>
-