Interface Distance
- All Superinterfaces:
Comparable<Distance>, OsidPrimitive, Serializable
- All Known Subinterfaces:
Distance
Supplements the OSID Distance interface for Java.
-
Method Summary
Modifier and TypeMethodDescriptionintCompares this distance with the specifiedDistanceto determine the natural order.booleanDetermines if the givenDistanceis equal to this one.Gets the lower bound of the distance.Gets the upper bound of the distance.inthashCode()Returns a hash code value for thisDistancebased on the types, values, granularity and uncertainties.booleanisContained(Distance distance1, Distance distance2) Tests if the range of this Distance, as specified by its uncertainty, is included within the given two Distances.booleanisExclusive(Distance distance) Tests if the range of this Distance, as specified by its uncertainty, does not overlap the given Distance.booleanisExclusive(Distance distance1, Distance distance2) Tests if the range of this Distance, as specified by its uncertainty, does not overlap with the range of the given two distances.booleanTests if this Distance is greater than the given Distance.booleanisInclusive(Distance distance) Tests if the range of this Distance, as specified by its uncertainty, includes the given Distance ranged by its uncertainty.booleanTests if this Distance is less than the given Distance.Methods inherited from interface OsidPrimitive
toString
-
Method Details
-
isGreater
Tests if this Distance is greater than the given Distance. A greater Distance is one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
distance- the distance to compare- Returns:
trueif this distance is larger,falseotherwise- Throws:
NullArgumentException-distanceisnull
-
isLess
Tests if this Distance is less than the given Distance. A lesser Distance is one whose values plus uncertainty is less than another minus its uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
distance- the distance to compare- Returns:
trueif this distance is less,falseotherwise- Throws:
NullArgumentException-distanceisnull
-
isInclusive
Tests if the range of this Distance, as specified by its uncertainty, includes the given Distance ranged by its uncertainty. If either distance has an uncertainty of infinity this method returns false.- Parameters:
distance- the distance to compare- Returns:
trueif this distance includes the given distance,falseotherwise- Throws:
NullArgumentException-distanceisnull
-
isContained
Tests if the range of this Distance, as specified by its uncertainty, is included within the given two Distances. If either distance has an uncertainty of infinity this method returns false.- Parameters:
distance1- the start distance to comparedistance2- the end distance to compare- Returns:
trueif this distance is included,falseotherwise- Throws:
NullArgumentException-distance1ordistance2isnull
-
isExclusive
Tests if the range of this Distance, as specified by its uncertainty, does not overlap the given Distance. If either distance has an uncertainty of infinity this method returns false.- Parameters:
distance- the distance to compare- Returns:
trueif this distance is excluded,falseotherwise- Throws:
NullArgumentException-distanceisnull
-
isExclusive
Tests if the range of this Distance, as specified by its uncertainty, does not overlap with the range of the given two distances. If either distance has an uncertainty of infinity this method returns false.- Parameters:
distance1- the start distance to comparedistance2- the end distance to compare- Returns:
trueif this distance is excluded,falseotherwise- Throws:
NullArgumentException-distance1ordistance2isnull
-
getLowerBound
Distance getLowerBound()Gets the lower bound of the distance. The lower bound is the distance minus the uncertainty.- Returns:
- the distance lower bound
-
getUpperBound
Distance getUpperBound()Gets the upper bound of the distance. The lower bound is the distance plus the uncertainty.- Returns:
- the distance upper bound
-
compareTo
Compares this distance with the specifiedDistanceto determine the natural order. Returns a negative integer, zero, or a positive integer as this distance is less than, equal to, or greater than the specified Distance. The natural ordering is determined first by the natural ordering of the type, then by its values. This method is not useful for numeric comparisons. The ranges implied by their granularities and uncertainties may overlap in such a way that two unequal Distances may be neither less than or greater than the other. IfcompareToa distance 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<Distance>- Parameters:
distance- the distance to be compared- Returns:
- a negative integer, zero, or a positive integer as this distance is less than, equal to, or greater than the specified distance
- Throws:
ClassCastException- if the specified distance's type prevents it from being compared to this distance
-
equals
-
hashCode
-