Interface Speed

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

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

    Modifier and Type
    Method
    Description
    int
    Compares this Speed with the specified Speed to determine the natural order.
    boolean
    Determines if the given Speeds is equal to this one.
    Gets the lower bound of the speed.
    Gets the upper bound of the speed.
    int
    Returns a hash code value for this Speed based on the distance and time units.
    boolean
    isContained(Speed speed1, Speed speed2)
    Tests if the range of this Speed, as specified by its uncertainty, is included within the given two Speeds.
    boolean
    Tests if the range of this Speed, as specified by its uncertainty, does not overlap the given Speed.
    boolean
    isExclusive(Speed speed1, Speed speed2)
    Tests if the range of this Speed, as specified by its uncertainty, does not overlap with the range of the given two speeds.
    boolean
    Tests if this Speed is greater than the given Speed.
    boolean
    Tests if the range of this Speed, as specified by its uncertainty, includes the given Speed ranged by its uncertainty.
    boolean
    isLess(Speed speed)
    Tests if this Speed is less than the given Speed.

    Methods inherited from interface OsidPrimitive

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

    • isGreater

      boolean isGreater(Speed speed)
      Tests if this Speed is greater than the given Speed. A greater Speed is one whose values minus uncertainty is greater than another plus its uncertainty. An uncertainty of infinity is undefined and returns false.
      Parameters:
      speed - the speed to compare
      Returns:
      true if this speed is larger, false otherwise
      Throws:
      NullArgumentException - speed is null
      UnsupportedException - cannot compare speed
    • isLess

      boolean isLess(Speed speed)
      Tests if this Speed is less than the given Speed. A lesser Speed is one whose values plus uncertainty is less than another minus its uncertainty. An uncertainty of infinity is undefined and returns false.
      Parameters:
      speed - the speed to compare
      Returns:
      true if this speed is less, false otherwise
      Throws:
      NullArgumentException - speed is null
      UnsupportedException - cannot compare speed
    • isInclusive

      boolean isInclusive(Speed speed)
      Tests if the range of this Speed, as specified by its uncertainty, includes the given Speed ranged by its uncertainty. If either speed has an uncertainty of infinity this method returns false.
      Parameters:
      speed - the speed to compare
      Returns:
      true if this speed includes the given speed, false otherwise
      Throws:
      NullArgumentException - speed is null
    • isContained

      boolean isContained(Speed speed1, Speed speed2)
      Tests if the range of this Speed, as specified by its uncertainty, is included within the given two Speeds. If either speed has an uncertainty of infinity this method returns false.
      Parameters:
      speed1 - the start speed to compare
      speed2 - the end speed to compare
      Returns:
      true if this speed is included, false otherwise
      Throws:
      NullArgumentException - speed1 or speed2 is null
    • isExclusive

      boolean isExclusive(Speed speed)
      Tests if the range of this Speed, as specified by its uncertainty, does not overlap the given Speed. If either speed has an uncertainty of infinity this method returns false.
      Parameters:
      speed - the speed to compare
      Returns:
      true if this speed is excluded, false otherwise
      Throws:
      NullArgumentException - speed is null
    • isExclusive

      boolean isExclusive(Speed speed1, Speed speed2)
      Tests if the range of this Speed, as specified by its uncertainty, does not overlap with the range of the given two speeds. If either speed has an uncertainty of infinity this method returns false.
      Parameters:
      speed1 - the start speed to compare
      speed2 - the end speed to compare
      Returns:
      true if this speed is excluded, false otherwise
      Throws:
      NullArgumentException - speed1 or speed2 is null
    • getLowerBound

      Speed getLowerBound()
      Gets the lower bound of the speed. The lower bound is the speed minus the uncertainty.
      Returns:
      the speed lower bound
    • getUpperBound

      Speed getUpperBound()
      Gets the upper bound of the speed. The lower bound is the speed plus the uncertainty.
      Returns:
      the speed upper bound
    • compareTo

      int compareTo(Speed speed)
      Compares this Speed with the specified Speed to determine the natural order. Returns a negative integer, zero, or a positive integer as this speed is less than, equal to, or greater than the specified speed. The natural ordering is determined first by the natural ordering of the speed scheme, then by its components. This method is not useful for numeric comparisons. The ranges implied by the granularities and uncertainties of their Distances and Durations may overlap in such a way that two unequal Speeds may be neither less than or greater than the other. If compareTo a speed 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<Speed>
      Parameters:
      speed - the speed to be compared
      Returns:
      a negative integer, zero, or a positive integer as this speed is less than, equal to, or greater than the specified speed
      Throws:
      ClassCastException - if the specified speed's type prevents it from being compared to this speed
    • equals

      boolean equals(Object obj)
      Determines if the given Speeds is equal to this one. Two versions are equal if their distance and time units are equal.
      Overrides:
      equals in class Object
      Parameters:
      obj - an object to compare
      Returns:
      true if the given object is equal to this Speed, false otherwise
    • hashCode

      int hashCode()
      Returns a hash code value for this Speed based on the distance and time units.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object