Interface Time

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

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

    Modifier and Type
    Method
    Description
    int
    Compares this Time with the specified Time to determine the natural order.
    Returns an interval based on this Time derived by its granularity.
    boolean
    Determines if the given Time is equal to this one.
    int
    Returns a hash code value for this Time based on the types, values, and granularity.
    boolean
    Tests if the range of this Time, as specified by its granularity, does not overlap the given Time.
    boolean
    Tests if this Time is greater than the given Time.
    boolean
    Tests if the range of this Time, as specified by its granularity, includes the given Time ranged by its grabularity.
    boolean
    Tests if this Time is less than the given Time.

    Methods inherited from interface OsidPrimitive

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

    • isGreater

      boolean isGreater(Time t)
      Tests if this Time is greater than the given Time. A greater Time is one whose values is greater than another plus its granularity.
      Parameters:
      t - the time to compare
      Returns:
      true if this time is larger, false otherwise
      Throws:
      NullArgumentException - t is null
      UnsupportedException - cannot compare calendar
    • isLess

      boolean isLess(Time t)
      Tests if this Time is less than the given Time. A lesser Time is one whose values plus granularity is less than another minus its granularity.
      Parameters:
      t - the time to compare
      Returns:
      true if this time is less, false otherwise
      Throws:
      NullArgumentException - t is null
      UnsupportedException - cannot compare calendar
    • isInclusive

      boolean isInclusive(Time t)
      Tests if the range of this Time, as specified by its granularity, includes the given Time ranged by its grabularity.
      Parameters:
      t - the time to compare
      Returns:
      true if this time includes the given time, false otherwise
      Throws:
      NullArgumentException - t is null
      UnsupportedException - cannot compare calendar
    • isExclusive

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

      Time[] denormalizeTime()
      Returns an interval based on this Time derived by its granularity.
      Returns:
      true if this time is excluded, false otherwise
    • compareTo

      int compareTo(Time time)
      Compares this Time with the specified Time to determine the natural order. Returns a negative integer, zero, or a positive integer as this time is less than, equal to, or greater than the specified time. The natural ordering is determined first by the natural ordering of the time scheme, then by its components. This method is not useful for numeric comparisons. The ranges implied by the granularities may overlap in such a way that two unequal Times may be neither less than or greater than the other. If compareTo an time 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<Time>
      Parameters:
      time - the time to be compared
      Returns:
      a negative integer, zero, or a positive integer as this time is less than, equal to, or greater than the specified time
      Throws:
      UnsupportedException - cannot compare calendar
    • equals

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

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