Interface Speed
- All Superinterfaces:
Comparable<Speed>, OsidPrimitive, Serializable
- All Known Subinterfaces:
Speed
Supplements the OSID Speed interface for Java.
-
Method Summary
Modifier and TypeMethodDescriptionintCompares this Speed with the specified Speed to determine the natural order.booleanDetermines if the givenSpeedsis equal to this one.Gets the lower bound of the speed.Gets the upper bound of the speed.inthashCode()Returns a hash code value for thisSpeedbased on the distance and time units.booleanisContained(Speed speed1, Speed speed2) Tests if the range of this Speed, as specified by its uncertainty, is included within the given two Speeds.booleanisExclusive(Speed speed) Tests if the range of this Speed, as specified by its uncertainty, does not overlap the given Speed.booleanisExclusive(Speed speed1, Speed speed2) Tests if the range of this Speed, as specified by its uncertainty, does not overlap with the range of the given two speeds.booleanTests if this Speed is greater than the given Speed.booleanisInclusive(Speed speed) Tests if the range of this Speed, as specified by its uncertainty, includes the given Speed ranged by its uncertainty.booleanTests if this Speed is less than the given Speed.Methods inherited from interface OsidPrimitive
toString
-
Method Details
-
isGreater
Tests if this Speed is greater than the given Speed. A greater Speed is one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
speed- the speed to compare- Returns:
trueif this speed is larger,falseotherwise- Throws:
NullArgumentException-speedisnullUnsupportedException- cannot compare speed
-
isLess
Tests if this Speed is less than the given Speed. A lesser Speed is one whose values plus uncertainty is less than another minus its uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
speed- the speed to compare- Returns:
trueif this speed is less,falseotherwise- Throws:
NullArgumentException-speedisnullUnsupportedException- cannot compare speed
-
isInclusive
Tests if the range of this Speed, as specified by its uncertainty, includes the given Speed ranged by its uncertainty. If either speed has an uncertainty of infinity this method returns false.- Parameters:
speed- the speed to compare- Returns:
trueif this speed includes the given speed,falseotherwise- Throws:
NullArgumentException-speedisnull
-
isContained
Tests if the range of this Speed, as specified by its uncertainty, is included within the given two Speeds. If either speed has an uncertainty of infinity this method returns false.- Parameters:
speed1- the start speed to comparespeed2- the end speed to compare- Returns:
trueif this speed is included,falseotherwise- Throws:
NullArgumentException-speed1orspeed2isnull
-
isExclusive
Tests if the range of this Speed, as specified by its uncertainty, does not overlap the given Speed. If either speed has an uncertainty of infinity this method returns false.- Parameters:
speed- the speed to compare- Returns:
trueif this speed is excluded,falseotherwise- Throws:
NullArgumentException-speedisnull
-
isExclusive
Tests if the range of this Speed, as specified by its uncertainty, does not overlap with the range of the given two speeds. If either speed has an uncertainty of infinity this method returns false.- Parameters:
speed1- the start speed to comparespeed2- the end speed to compare- Returns:
trueif this speed is excluded,falseotherwise- Throws:
NullArgumentException-speed1orspeed2isnull
-
getLowerBound
Speed getLowerBound()Gets the lower bound of the speed. The lower bound is the speed minus the uncertainty.- Returns:
- the speed lower bound
-
getUpperBound
Speed getUpperBound()Gets the upper bound of the speed. The lower bound is the speed plus the uncertainty.- Returns:
- the speed upper bound
-
compareTo
Compares this Speed with the specified Speed to determine the natural order. Returns a negative integer, zero, or a positive integer as this speed is less than, equal to, or greater than the specified speed. The natural ordering is determined first by the natural ordering of the speed scheme, then by its components. This method is not useful for numeric comparisons. The ranges implied by the granularities and uncertainties of their Distances and Durations may overlap in such a way that two unequal Speeds may be neither less than or greater than the other. IfcompareToa speed is zero, thenequals()must betrueand their hash codes must also be equal for consistent behavior. For orderings that may yield inconsistent behavior, an externalComparatorshould be used.- Specified by:
compareToin interfaceComparable<Speed>- Parameters:
speed- the speed to be compared- Returns:
- a negative integer, zero, or a positive integer as this speed is less than, equal to, or greater than the specified speed
- Throws:
ClassCastException- if the specified speed's type prevents it from being compared to this speed
-
equals
-
hashCode
-