Interface Coordinate
- All Superinterfaces:
Comparable<Coordinate>, OsidPrimitive, Serializable
- All Known Subinterfaces:
Coordinate
Supplements the OSID Coordinate interface for Java.
-
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(Coordinate coordinate) Compares this coordinate with the specifiedCoordinateto determine the natural order.booleanDetermines if the givenCoordinateis equal to this one.Gets the closest bound of the coordinate.Gets the farthest bound of the coordinate.Gets the outer bound of the coordinate.inthashCode()Returns a hash code value for thisCoordinate.booleanisCloser(Coordinate one, Coordinate another) Tests if oneCoordinateis closer to origin than another to thisCoordinate.booleanisExclusive(Coordinate coordinate) Tests if thisCoordinate, as specified by its uncertainty, does not overlap the givenCoordinate.booleanisFarther(Coordinate one, Coordinate another) Tests if oneCoordinateis farther from origin than another from thisCoordinate.booleanisInclusive(Coordinate coordinate) Tests if thisCoordinate, as specified by its uncertainty, completely includes the givenCoordinateranged by its uncertainty.booleanisLarger(Coordinate coordinate) Tests if thisCoordinateis greater in area than the givenCoordinate.booleanisSmaller(Coordinate coordinate) Tests if thisCoordinateis less in area than the givenCoordinate.Methods inherited from interface OsidPrimitive
toString
-
Method Details
-
isLarger
Tests if thisCoordinateis greater in area than the givenCoordinate. A greaterCoordinateis one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false. It is possible forisLarger(),isSmaller(), and equals() to be allfalseamong twoCoordinatesdue to uncertainties in the values. In this case,compareTo()may elect to return a value to provide a natural ordering but should not be used to determine equality.equals()tends to have a stricter definition of equality.- Parameters:
coordinate- the coordinate to compare- Returns:
trueif this coordinate is larger,falseotherwise- Throws:
NullArgumentException-coordinateisnullUnsupportedException- cannot compare coordinate
-
isSmaller
Tests if thisCoordinateis less in area than the givenCoordinate. A lesserCoordinateis one whose values plus uncertainty is less than another minus its uncertainty. An uncertainty of infinity is undefined and returns false. It is possible forisLarger(),isSmaller(), and equals() to be allfalseamong twoCoordinatesdue to uncertainties in the values. In this case,compareTo()may elect to return a value to provide a natural ordering but should not be used to determine equality.equals()tends to have a stricter definition of equality.- Parameters:
coordinate- the coordinate to compare- Returns:
trueif this coordinate is less,falseotherwise- Throws:
NullArgumentException-coordinateisnullUnsupportedException- cannot compare coordinate
-
isCloser
Tests if oneCoordinateis closer to origin than another to thisCoordinate. A greaterCoordinateis one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false. It is possible forisCloser()andisFarther()to be bothfalseamong twoCoordinatesdue to uncertainties in the values.- Parameters:
one- the coordinate to compareanother- the coordinate to compare- Returns:
trueif thisoneis closer thananother,falseotherwise- Throws:
NullArgumentException-oneoranotherisnullUnsupportedException- cannot compare coordinate
-
isFarther
Tests if oneCoordinateis farther from origin than another from thisCoordinate. A greaterCoordinateis one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false. It is possible forisCloser()andisFarther()to be bothfalseamong twoCoordinatesdue to uncertainties in the values.- Parameters:
one- the coordinate to compareanother- the coordinate to compare- Returns:
trueif thisoneis closer thananother,falseotherwise- Throws:
NullArgumentException-oneoranotherisnullUnsupportedException- cannot compare coordinate
-
isInclusive
Tests if thisCoordinate, as specified by its uncertainty, completely includes the givenCoordinateranged by its uncertainty. If either coordinate has an uncertainty of infinity this method returns false. It is possible forisInclusive()andisExclsuive()to be bothfalseamong twoCoordinatesdue to uncertainties in the values.- Parameters:
coordinate- the coordinate to compare- Returns:
trueif this coordinate includes the given coordinate,falseotherwise- Throws:
NullArgumentException-coordinateisnullUnsupportedException- cannot compare coordinate
-
isExclusive
Tests if thisCoordinate, as specified by its uncertainty, does not overlap the givenCoordinate. If either coordinate has an uncertainty of infinity this method returns false. It is possible forisInclusive()andisExclsuive()to be bothfalseamong twoCoordinatesdue to uncertainties in the values.- Parameters:
coordinate- the coordinate to compare- Returns:
trueif this coordinate is excluded,falseotherwise- Throws:
NullArgumentException-coordinateisnullUnsupportedException- cannot compare coordinate
-
getOuterBound
SpatialUnit getOuterBound()Gets the outer bound of the coordinate. The outer bound is the coordinate plus the uncertainty. This method returns the area around the Coordinate with the largest radius allowed by its uncertainty.- Returns:
- the coordinate upper bound
-
getClosestBound
Coordinate getClosestBound()Gets the closest bound of the coordinate. The closest bound is the coordinate of the same granularity in the uncertainty range closest to the origin.- Returns:
- the coordinate lower bound
-
getFarthestBound
Coordinate getFarthestBound()Gets the farthest bound of the coordinate. The farthest bound is the coordinate of the same granularity in the uncertainty range farthest from the origin.- Returns:
- the coordinate upper bound
-
compareTo
Compares this coordinate with the specifiedCoordinateto determine the natural order. Returns a negative integer, zero, or a positive integer as this coordinate is less than, equal to, or greater than the specified coordinate. The natural ordering is determined first by the natural ordering of the coordinate 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 Coordinates may be neither less than or greater than the other. IfcompareToa coordinate 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<Coordinate>- Parameters:
coordinate- the coordinate to be compared- Returns:
- a negative integer, zero, or a positive integer as this coordinate is less than, equal to, or greater than the specified coordinate
- Throws:
ClassCastException- if the specified coordinate's type prevents it from being compared to this coordinate
-
equals
Determines if the givenCoordinateis equal to this one. TwoCoordinatesare equal if their coordinate types, values, and uncertainties are equal. Ifequals()istrue, thencompareTo()must be zero and their hash codes must also be equal for consistent behavior. For orderings that may yield inconsistent behavior, an externalComparatorshould be used. Ifobjis null or if a different interface, this method returnsfalse. -
hashCode
-