Interface Duration
- All Superinterfaces:
Comparable<Duration>, OsidPrimitive, Serializable
- All Known Subinterfaces:
Duration
Supplements the OSID Duration interface for Java.
-
Method Summary
Modifier and TypeMethodDescriptionintCompares this duration with the specifiedDurationto determine the natural order.booleanDetermines if the givenDurationis equal to this one.Gets the lower bound of the duration.Gets the upper bound of the duration.inthashCode()Returns a hash code value for thisDurationbased on the types, values, granularity, and uncertainties.booleanisExclusive(Duration duration) Tests if the range of this Duration, as specified by its granularity and uncertainty, does not overlap the given Duration.booleanTests if this Duration is greater than the given Duration.booleanisInclusive(Duration duration) Tests if the range of this Duration, as specified by its granularity and uncertainty, includes the given Duration ranged by its grabularity and uncertainty.booleanTests if this Duration is less than the given Duration.Methods inherited from interface OsidPrimitive
toString
-
Method Details
-
isGreater
Tests if this Duration is greater than the given Duration. A greater Duration 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:
duration- the duration to compare- Returns:
trueif this duration is larger,falseotherwise- Throws:
NullArgumentException-durationisnullUnsupportedException- cannot compare calendar
-
isLess
Tests if this Duration is less than the given Duration. A lesser Duration is one whose values plus granularity and uncertainty is less than another minus its d uncertainty. An uncertainty of infinity is undefined and returns false.- Parameters:
duration- the duration to compare- Returns:
trueif this duration is less,falseotherwise- Throws:
NullArgumentException-durationisnullUnsupportedException- cannot compare calendar
-
isInclusive
Tests if the range of this Duration, as specified by its granularity and uncertainty, includes the given Duration ranged by its grabularity and uncertainty. If either duration has an uncertainty of infinity this method returns false.- Parameters:
duration- the duration to compare- Returns:
trueif this duration includes the given duration,falseotherwise- Throws:
NullArgumentException-durationisnullUnsupportedException- cannot compare calendar
-
isExclusive
Tests if the range of this Duration, as specified by its granularity and uncertainty, does not overlap the given Duration. If either duration has an uncertainty of infinity this method returns false.- Parameters:
duration- the duration to compare- Returns:
trueif this duration is excluded,falseotherwise- Throws:
NullArgumentException-durationisnullUnsupportedException- cannot compare calendar
-
getLowerBound
Duration getLowerBound()Gets the lower bound of the duration. The lower bound is the duration minus the uncertainty.- Returns:
- the duration lower bound
-
getUpperBound
Duration getUpperBound()Gets the upper bound of the duration. The lower bound is the duration plus the uncertainty.- Returns:
- the duration upper bound
-
compareTo
Compares this duration with the specifiedDurationto determine the natural order. Returns a negative integer, zero, or a positive integer as this duration is less than, equal to, or greater than the specified Duration. 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 Durations may be neither less than or greater than the other. IfcompareToa duration 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<Duration>- Parameters:
duration- the duration to be compared- Returns:
- a negative integer, zero, or a positive integer as this duration is less than, equal to, or greater than the specified duration
- Throws:
ClassCastException- if the specified duration's type prevents it from being compared to this duration
-
equals
Determines if the givenDurationis equal to this one. Two Durations are equal if their Types, granularities, values, and uncertainties are equal. -
hashCode
-