Interface SpatialUnit

All Superinterfaces:
Comparable<SpatialUnit>, OsidPrimitive, Serializable
All Known Subinterfaces:
SpatialUnit

public interface SpatialUnit extends OsidPrimitive, Comparable<SpatialUnit>
Supplements the OSID SpatialUnit interface for Java.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this spatial unit with the specified SpatialUnit to determine the natural order.
    boolean
    Determines if the given SpatialUnit is equal to this one.
    Gets the lower bound of the spatial unit.
    Gets the upper bound of the spatial unit.
    int
    Returns a hash code value for this SpatialUnit based on the types, values, granularity, and uncertainties.
    boolean
    Tests if one SpatialUnit is closer than another to this SpatialUnit.
    boolean
    Tests if this SpatialUnit, as specified by its uncertainty, does not overlap the given SpatialUnit.
    boolean
    Tests if one SpatialUnit is farther than another from this SpatialUnit.
    boolean
    Tests if the SpatialUnit, as specified by its uncertainty, completely includes the given SpatialUnit ranged by its uncertainty.
    boolean
    Tests if this SpatialUnit is greater than the given SpatialUnit.
    boolean
    Tests if this SpatialUnit is less than the given SpatialUnit.

    Methods inherited from interface OsidPrimitive

    toString
    Modifier and Type
    Method
    Description
    Returns a string representation of this OsidPrimitive.
  • Method Details

    • isLarger

      boolean isLarger(SpatialUnit unit)
      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:
      true if this spatial unit is larger, false otherwise
      Throws:
      NullArgumentException - unit is null
      UnsupportedException - cannot compare spatial unit
    • isSmaller

      boolean isSmaller(SpatialUnit unit)
      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:
      true if this spatial unit is less, false otherwise
      Throws:
      NullArgumentException - unit is null
      UnsupportedException - cannot compare spatial unit
    • isCloser

      boolean isCloser(SpatialUnit one, SpatialUnit another)
      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 compare
      another - the spatial unit to compare
      Returns:
      true if this one is closer than another, false otherwise
      Throws:
      NullArgumentException - one or another is null
      UnsupportedException - cannot compare spatial unit
    • isFarther

      boolean isFarther(SpatialUnit one, SpatialUnit another)
      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 compare
      another - the spatial unit to compare
      Returns:
      true if this one is closer than another, false otherwise
      Throws:
      NullArgumentException - one or another is null
      UnsupportedException - cannot compare spatial unit
    • isInclusive

      boolean isInclusive(SpatialUnit unit)
      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:
      true if this spatial unit includes the given spatial unit, false otherwise
      Throws:
      NullArgumentException - unit is null
      UnsupportedException - cannot compare spatial unit
    • isExclusive

      boolean isExclusive(SpatialUnit unit)
      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:
      true if this spatial unit is excluded, false otherwise
      Throws:
      NullArgumentException - unit is null
      UnsupportedException - 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

      int compareTo(SpatialUnit unit)
      Compares this spatial unit with the specified SpatialUnit to 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. If compareTo a spatial unit 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.
      Specified by:
      compareTo in interface Comparable<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

      boolean equals(Object obj)
      Determines if the given SpatialUnit is equal to this one.
      Overrides:
      equals in class Object
      Parameters:
      obj - an object to compare
      Returns:
      true if the given object is equal to this Spatial Unit, false otherwise
    • hashCode

      int hashCode()
      Returns a hash code value for this SpatialUnit based on the types, values, granularity, and uncertainties.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object