Interface SpatialUnit
- All Superinterfaces:
Comparable<SpatialUnit>, OsidPrimitive, Serializable
- All Known Subinterfaces:
SpatialUnit
Supplements the OSID SpatialUnit interface for Java.
-
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(SpatialUnit unit) Compares this spatial unit with the specifiedSpatialUnitto determine the natural order.booleanDetermines if the givenSpatialUnitis equal to this one.Gets the lower bound of the spatial unit.Gets the upper bound of the spatial unit.inthashCode()Returns a hash code value for thisSpatialUnitbased on the types, values, granularity, and uncertainties.booleanisCloser(SpatialUnit one, SpatialUnit another) Tests if one SpatialUnit is closer than another to this SpatialUnit.booleanisExclusive(SpatialUnit unit) Tests if this SpatialUnit, as specified by its uncertainty, does not overlap the given SpatialUnit.booleanisFarther(SpatialUnit one, SpatialUnit another) Tests if one SpatialUnit is farther than another from this SpatialUnit.booleanisInclusive(SpatialUnit unit) Tests if the SpatialUnit, as specified by its uncertainty, completely includes the given SpatialUnit ranged by its uncertainty.booleanisLarger(SpatialUnit unit) Tests if this SpatialUnit is greater than the given SpatialUnit.booleanisSmaller(SpatialUnit unit) Tests if this SpatialUnit is less than the given SpatialUnit.Methods inherited from interface OsidPrimitive
toString
-
Method Details
-
isLarger
Tests if this SpatialUnit is greater than the given SpatialUnit. A greater SpatialUnit is one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
unit- the spatial unit to compare- Returns:
trueif this spatial unit is larger,falseotherwise- Throws:
NullArgumentException-unitisnullUnsupportedException- cannot compare spatial unit
-
isSmaller
Tests if this SpatialUnit is less than the given SpatialUnit. A lesser SpatialUnit is one whose values plus uncertainty is less than another minus its uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
unit- the spatial unit to compare- Returns:
trueif this spatial unit is less,falseotherwise- Throws:
NullArgumentException-unitisnullUnsupportedException- cannot compare spatial unit
-
isCloser
Tests if one SpatialUnit is closer than another to this SpatialUnit. A greater SpatialUnit is one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
one- the spatial unit to compareanother- the spatial unit to compare- Returns:
trueif thisoneis closer thananother,falseotherwise- Throws:
NullArgumentException-oneoranotherisnullUnsupportedException- cannot compare spatial unit
-
isFarther
Tests if one SpatialUnit is farther than another from this SpatialUnit. A greater SpatialUnit is one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
one- the spatial unit to compareanother- the spatial unit to compare- Returns:
trueif thisoneis closer thananother,falseotherwise- Throws:
NullArgumentException-oneoranotherisnullUnsupportedException- cannot compare spatial unit
-
isInclusive
Tests if the SpatialUnit, as specified by its uncertainty, completely includes the given SpatialUnit ranged by its uncertainty. If either spatial unit has an uncertainty of infinity this method returns false.- Parameters:
unit- the spatial unit to compare- Returns:
trueif this spatial unit includes the given spatial unit,falseotherwise- Throws:
NullArgumentException-unitisnullUnsupportedException- cannot compare spatial unit
-
isExclusive
Tests if this SpatialUnit, as specified by its uncertainty, does not overlap the given SpatialUnit. If either spatial unit has an uncertainty of infinity this method returns false.- Parameters:
unit- the spatial unit to compare- Returns:
trueif this spatial unit is excluded,falseotherwise- Throws:
NullArgumentException-unitisnullUnsupportedException- cannot compare spatial unit
-
getInnerBound
SpatialUnit getInnerBound()Gets the lower bound of the spatial unit. The lower bound is the unit minus the uncertainty.- Returns:
- the unit lower bound
-
getOuterBound
SpatialUnit getOuterBound()Gets the upper bound of the spatial unit. The lower bound is the unit plus the uncertainty.- Returns:
- the unit upper bound
-
compareTo
Compares this spatial unit with the specifiedSpatialUnitto determine the natural order. Returns a negative integer, zero, or a positive integer as this spatial unit is less than, equal to, or greater than the specified SpatialUnit. 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 SpatialUnits may be neither less than or greater than the other. IfcompareToa spatial unit 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<SpatialUnit>- Parameters:
unit- the spatial unit to be compared- Returns:
- a negative integer, zero, or a positive integer as this spatial unit is less than, equal to, or greater than the specified spatial unit
- Throws:
ClassCastException- if the specified spatial unit's type prevents it from being compared to this spatial unit
-
equals
-
hashCode
-