public interface Duration extends OsidPrimitive, java.lang.Comparable<Duration>
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Duration duration)
Compares this duration with the specified
Duration
to determine the natural order. |
boolean |
equals(java.lang.Object obj)
Determines if the given
Duration is equal to
this one. |
Duration |
getLowerBound()
Gets the lower bound of the duration.
|
Duration |
getUpperBound()
Gets the upper bound of the duration.
|
int |
hashCode()
Returns a hash code value for this
Duration based
on the types, values, granularity, and uncertainties. |
boolean |
isExclusive(Duration duration)
Tests if the range of this Duration, as specified by its
granularity and uncertainty, does not overlap the given
Duration.
|
boolean |
isGreater(Duration duration)
Tests if this Duration is greater than the given Duration.
|
boolean |
isInclusive(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.
|
boolean |
isLess(Duration duration)
Tests if this Duration is less than the given Duration.
|
toString
boolean isGreater(Duration duration)
duration
- the duration to comparetrue
if this duration is larger,
false
otherwiseNullArgumentException
- duration
is null
UnsupportedException
- cannot compare calendarboolean isLess(Duration duration)
duration
- the duration to comparetrue
if this duration is less,
false
otherwiseNullArgumentException
- duration
is null
UnsupportedException
- cannot compare calendarboolean isInclusive(Duration duration)
duration
- the duration to comparetrue
if this duration includes the given
duration, false
otherwiseNullArgumentException
- duration
is null
UnsupportedException
- cannot compare calendarboolean isExclusive(Duration duration)
duration
- the duration to comparetrue
if this duration is excluded,
false
otherwiseNullArgumentException
- duration
is null
UnsupportedException
- cannot compare calendarDuration getLowerBound()
Duration getUpperBound()
int compareTo(Duration duration)
Duration
to 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.
If compareTo
a duration 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.compareTo
in interface java.lang.Comparable<Duration>
duration
- the duration to be comparedjava.lang.ClassCastException
- if the specified duration's type
prevents it from being compared to this durationboolean equals(java.lang.Object obj)
Duration
is equal to
this one. Two Durations are equal if their Types,
granularities, values, and uncertainties are equal.equals
in class java.lang.Object
obj
- an object to compare true
if the given object is equal to
this Duration
, false
otherwiseint hashCode()
Duration
based
on the types, values, granularity, and uncertainties.hashCode
in class java.lang.Object