Interface Distance

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

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

    Modifier and Type
    Method
    Description
    int
    compareTo(Distance distance)
    Compares this distance with the specified Distance to determine the natural order.
    boolean
    Determines if the given Distance is equal to this one.
    Gets the lower bound of the distance.
    Gets the upper bound of the distance.
    int
    Returns a hash code value for this Distance based on the types, values, granularity and uncertainties.
    boolean
    isContained(Distance distance1, Distance distance2)
    Tests if the range of this Distance, as specified by its uncertainty, is included within the given two Distances.
    boolean
    Tests if the range of this Distance, as specified by its uncertainty, does not overlap the given Distance.
    boolean
    isExclusive(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.
    boolean
    isGreater(Distance distance)
    Tests if this Distance is greater than the given Distance.
    boolean
    Tests if the range of this Distance, as specified by its uncertainty, includes the given Distance ranged by its uncertainty.
    boolean
    isLess(Distance distance)
    Tests if this Distance is less than the given Distance.

    Methods inherited from interface OsidPrimitive

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

    • isGreater

      boolean isGreater(Distance distance)
      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:
      true if this distance is larger, false otherwise
      Throws:
      NullArgumentException - distance is null
    • isLess

      boolean isLess(Distance distance)
      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:
      true if this distance is less, false otherwise
      Throws:
      NullArgumentException - distance is null
    • isInclusive

      boolean isInclusive(Distance distance)
      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:
      true if this distance includes the given distance, false otherwise
      Throws:
      NullArgumentException - distance is null
    • isContained

      boolean isContained(Distance distance1, Distance distance2)
      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 compare
      distance2 - the end distance to compare
      Returns:
      true if this distance is included, false otherwise
      Throws:
      NullArgumentException - distance1 or distance2 is null
    • isExclusive

      boolean isExclusive(Distance distance)
      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:
      true if this distance is excluded, false otherwise
      Throws:
      NullArgumentException - distance is null
    • isExclusive

      boolean isExclusive(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. If either distance has an uncertainty of infinity this method returns false.
      Parameters:
      distance1 - the start distance to compare
      distance2 - the end distance to compare
      Returns:
      true if this distance is excluded, false otherwise
      Throws:
      NullArgumentException - distance1 or distance2 is null
    • 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

      int compareTo(Distance distance)
      Compares this distance with the specified Distance to 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. If compareTo a distance 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<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

      boolean equals(Object obj)
      Determines if the given Distance 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 DateTime, false otherwise
    • hashCode

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