|
|||||||||
| Home >> All >> [ jtemporal overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jtemporal
Interface Instant

- All Superinterfaces:
- java.lang.Comparable
- All Known Implementing Classes:
- IntInstant
- public interface Instant
- extends java.lang.Comparable
You must implement this interface (basically a Comparable) to
represent time. The implementing object must be immutable.
If you are in nuclear particle research you won't use the same class
as if you are a geologist.
You can write a little adapter wrapping java.util.Date. Most users rether use
"pure" dates, to avoid issues with timezones. There are many opensource
implementations of Julian date and of Gregorian date.
Many companies have their own date/calendar framework.
For example, in my unit test classes, I have simply adapted an int.
Any object implementing this interface is required to be immutable. This
is part of the contract.
Do not forget to implement equals and hashCode properly, as defined in the
java.lang.Object documentation.
Also, the equals method must be consistent with the compareTo method.
- Version:
- $Id$
| Method Summary | |
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
Instant |
negativeInfinity()
Returns the lowest existing Instant. |
Instant |
positiveInfinity()
Returns the biggest existing Instant. |
| Method Detail |
compareTo
public int compareTo(java.lang.Object o)
- Compares this object with the specified object for order. Returns a
negative integer, zero, or a positive integer as this object is less
than, equal to, or greater than the specified object.
The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)
The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.
Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.
It is required that (x.compareTo(y)==0) == (x.equals(y)).
- Specified by:
compareToin interfacejava.lang.Comparable
positiveInfinity
public Instant positiveInfinity()
- Returns the biggest existing Instant.
The implementation of this method is not mandatory.
It could become mandatory in a future version.
negativeInfinity
public Instant negativeInfinity()
- Returns the lowest existing Instant.
The implementation of this method is not mandatory.
It could become mandatory in a future version.
|
|||||||||
| Home >> All >> [ jtemporal overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC