public interface Coordinate extends OsidPrimitive, java.lang.Comparable<Coordinate>
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Coordinate coordinate)
Compares this coordinate with the specified
Coordinate to determine the natural
order. |
boolean |
equals(java.lang.Object obj)
Determines if the given
Coordinate is equal to
this one. |
Coordinate |
getClosestBound()
Gets the closest bound of the coordinate.
|
Coordinate |
getFarthestBound()
Gets the farthest bound of the coordinate.
|
SpatialUnit |
getOuterBound()
Gets the outer bound of the coordinate.
|
int |
hashCode()
Returns a hash code value for this
Coordinate . |
boolean |
isCloser(Coordinate one,
Coordinate another)
Tests if one
Coordinate is closer to origin than
another to this Coordinate . |
boolean |
isExclusive(Coordinate coordinate)
Tests if this
Coordinate , as specified by its
uncertainty, does not overlap the given
Coordinate . |
boolean |
isFarther(Coordinate one,
Coordinate another)
Tests if one
Coordinate is farther from origin
than another from this Coordinate . |
boolean |
isInclusive(Coordinate coordinate)
Tests if this
Coordinate , as specified by its
uncertainty, completely includes the given
Coordinate ranged by its uncertainty. |
boolean |
isLarger(Coordinate coordinate)
Tests if this
Coordinate is greater in area than
the given Coordinate . |
boolean |
isSmaller(Coordinate coordinate)
Tests if this
Coordinate is less in area than the
given Coordinate . |
toString
boolean isLarger(Coordinate coordinate)
Coordinate
is greater in area than
the given Coordinate
. A greater
Coordinate
is one whose values minus uncertainty
is greater than another plus its uncertainty. An uncertainty
of infinity is undefined and returns false.
It is possible for isLarger()
,
isSmaller()
, and equals() to be all
false
among two Coordinates
due 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.coordinate
- the coordinate to comparetrue
if this coordinate is larger,
false
otherwiseNullArgumentException
- coordinate
is null
UnsupportedException
- cannot compare coordinateboolean isSmaller(Coordinate coordinate)
Coordinate
is less in area than the
given Coordinate
. A lesser
Coordinate
is one whose values plus uncertainty
is less than another minus its uncertainty. An uncertainty of
infinity is undefined and returns false.
It is possible for isLarger()
,
isSmaller()
, and equals() to be all
false
among two Coordinates
due 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.coordinate
- the coordinate to comparetrue
if this coordinate is less,
false
otherwiseNullArgumentException
- coordinate
is null
UnsupportedException
- cannot compare coordinateboolean isCloser(Coordinate one, Coordinate another)
Coordinate
is closer to origin than
another to this Coordinate
. A greater
Coordinate
is one whose values minus uncertainty
is greater than another plus its uncertainty. An uncertainty
of infinity is undefined and returns false.
It is possible for isCloser()
and
isFarther()
to be both false
among
two Coordinates
due to uncertainties in the
values.one
- the coordinate to compareanother
- the coordinate to comparetrue
if this one
is closer
than another
, false
otherwiseNullArgumentException
- one
or
another
is null
UnsupportedException
- cannot compare coordinateboolean isFarther(Coordinate one, Coordinate another)
Coordinate
is farther from origin
than another from this Coordinate
. A greater
Coordinate
is one whose values minus uncertainty
is greater than another plus its uncertainty. An uncertainty
of infinity is undefined and returns false.
It is possible for isCloser()
and
isFarther()
to be both false
among
two Coordinates
due to uncertainties in the
values.one
- the coordinate to compareanother
- the coordinate to comparetrue
if this one
is closer
than another
, false
otherwiseNullArgumentException
- one
or
another
is null
UnsupportedException
- cannot compare coordinateboolean isInclusive(Coordinate coordinate)
Coordinate
, as specified by its
uncertainty, completely includes the given
Coordinate
ranged by its uncertainty.
If either coordinate has an uncertainty of infinity this
method returns false.
It is possible for isInclusive()
and
isExclsuive()
to be both false
among
two Coordinates
due to uncertainties in the
values.coordinate
- the coordinate to comparetrue
if this coordinate includes the given
coordinate, false
otherwiseNullArgumentException
- coordinate
is null
UnsupportedException
- cannot compare coordinateboolean isExclusive(Coordinate coordinate)
Coordinate
, as specified by its
uncertainty, does not overlap the given
Coordinate
.
If either coordinate has an uncertainty of infinity this
method returns false.
It is possible for isInclusive()
and
isExclsuive()
to be both false
among
two Coordinates
due to uncertainties in the
values.coordinate
- the coordinate to comparetrue
if this coordinate is excluded,
false
otherwiseNullArgumentException
- coordinate
is null
UnsupportedException
- cannot compare coordinateSpatialUnit getOuterBound()
Coordinate getClosestBound()
Coordinate getFarthestBound()
int compareTo(Coordinate coordinate)
Coordinate
to 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.
If compareTo
a coordinate is zero, then
equals()
must be true
and their hash
codes must also be equal for consistent behavior. For
orderings that may yield inconsistent behavior, an external
Comparator
should be used.compareTo
in interface java.lang.Comparable<Coordinate>
coordinate
- the coordinate to be comparedjava.lang.ClassCastException
- if the specified coordinate's type
prevents it from being compared to this coordinateboolean equals(java.lang.Object obj)
Coordinate
is equal to
this one. Two Coordinates
are equal if their
coordinate types, values, and uncertainties are equal.
If equals()
is true
, then
compareTo()
must be zero and their hash codes
must also be equal for consistent behavior. For orderings that
may yield inconsistent behavior, an external
Comparator
should be used.
If obj
is null or if a different interface, this
method returns false
.equals
in class java.lang.Object
obj
- an object to compare true
if the given object is equal to
this Coordinate
, false
otherwiseint hashCode()
Coordinate
.
The hash code is determined by the coordinate type, values,
and uncertainty.hashCode
in class java.lang.Object