Interface DateTime
- All Superinterfaces:
Comparable<DateTime>, OsidPrimitive, Serializable
- All Known Subinterfaces:
DateTime
Supplements the OSID DateTime interface for Java.
-
Method Summary
Modifier and TypeMethodDescriptionintCompares this datetime with the specifiedDateTimeto determine the natural order.Returns an interval based on this DateTime derived by its granularity and uncertainty.booleanDetermines if the givenDateTimeis equal to this one.inthashCode()Returns a hash code value for thisDateTimebased on the types, values, granularity and uncertainties.booleanisExclusive(DateTime datetime) Tests if the range of this DateTime, as specified by its granularity and uncertainty, does not overlap the given DateTime.booleanTests if this DateTime is greater than the given DateTime.booleanisInclusive(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.booleanTests if this DateTime is less than the given DateTime.Methods inherited from interface OsidPrimitive
toString
-
Method Details
-
isGreater
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:
trueif this datetime is larger,falseotherwise- Throws:
NullArgumentException-datetimeisnullUnsupportedException- cannot compare calendar
-
isLess
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:
trueif this datetime is less,falseotherwise- Throws:
NullArgumentException-datetimeisnullUnsupportedException- cannot compare calendar
-
isInclusive
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:
trueif this datetime includes the given datetime,falseotherwise- Throws:
NullArgumentException-datetimeisnullUnsupportedException- cannot compare calendar
-
isExclusive
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:
trueif this datetime is excluded,falseotherwise- Throws:
NullArgumentException-datetimeisnullUnsupportedException- cannot compare calendar
-
denormalize
DateTimeInterval denormalize()Returns an interval based on this DateTime derived by its granularity and uncertainty.- Returns:
trueif this datetime is excluded,falseotherwise
-
compareTo
Compares this datetime with the specifiedDateTimeto 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. IfcompareToa datetime is zero, thenequals()must betrueand their hash codes must also be equal for consistent behavior. For orderings that may yield inconsistent behavior, an externalComparatorshould be used.- Specified by:
compareToin interfaceComparable<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
Determines if the givenDateTimeis equal to this one. Two DateTimes are equal if their Types, values, granularity, and uncertainties are equal. -
hashCode
-