Interface DateTime

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

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

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

    Methods inherited from interface OsidPrimitive

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

    • isGreater

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

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

      boolean isInclusive(DateTime datetime)
      Tests if the range of this DateTime, as specified by its granularity and uncertainty, includes the given DateTime ranged by its grabularity and uncertainty. If either datetime has an uncertainty of infinity this method returns false.
      Parameters:
      datetime - the datetime to compare
      Returns:
      true if this datetime includes the given datetime, false otherwise
      Throws:
      NullArgumentException - datetime is null
      UnsupportedException - cannot compare calendar
    • isExclusive

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

      DateTimeInterval denormalize()
      Returns an interval based on this DateTime derived by its granularity and uncertainty.
      Returns:
      true if this datetime is excluded, false otherwise
    • compareTo

      int compareTo(DateTime datetime)
      Compares this datetime with the specified DateTime to determine the natural order. Returns a negative integer, zero, or a positive integer as this datetime is less than, equal to, or greater than the specified datetime. The natural ordering is determined first by the natural ordering of the calendar and time types, 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 DateTimes may be neither less than or greater than the other. If compareTo a datetime 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<DateTime>
      Parameters:
      datetime - the datetime to be compared
      Returns:
      a negative integer, zero, or a positive integer as this datetime is less than, equal to, or greater than the specified datetime
      Throws:
      ClassCastException - if the specified datetime's type prevents it from being compared to this datetime
    • equals

      boolean equals(Object obj)
      Determines if the given DateTime is equal to this one. Two DateTimes are equal if their Types, values, granularity, and uncertainties are equal.
      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 DateTime based on the types, values, granularity and uncertainties.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object