-------- Original Message --------
Hi Kendall, On Tue, 2005-11-22 at 09:55 -0600, Kendall Bell wrote: > 2005-11-21 Kendall Bell <[EMAIL PROTECTED]> > > * java/util/Calendar.java: > Implemented Comparable. > (compareTo) Method added. Thanks. Could you also email that to the classpath-patches list so others can review? Also Tom said that there was another implementation on the generics branch (he is in Brazil and can apparently not sent email). Could you compare that implementation with your implementation? http://www.gnu.org/philosophy/java-trap.html Join the community at http://planet.classpath.org/
signature.asc --- End Message ---
signature.asc Index: classpath/java/util/Calendar.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/util/Calendar.java,v retrieving revision 1.47 diff -u -r1.47 Calendar.java --- classpath/java/util/Calendar.java 1 Oct 2005 19:45:23 -0000 1.47 +++ classpath/java/util/Calendar.java 22 Nov 2005 15:40:58 -0000 @@ -103,7 +103,7 @@ * @see TimeZone * @see java.text.DateFormat */ -public abstract class Calendar implements Serializable, Cloneable +public abstract class Calendar implements Serializable, Cloneable, Comparable { /** * Constant representing the era time field. @@ -1290,5 +1290,18 @@ isSet = new boolean[FIELD_COUNT]; areFieldsSet = false; } + } + + /** + *Compares the time values (in millisecond offsets) represented by two Calendar objects. + * @param c the calendar to that we should compare. + * @return 0, if the given calendar is equal, -1 if it is less then, or 1 if greater then. + */ + public int compareTo(Calendar c) + { + if (getTimeInMillis() == c.getTimeInMillis()) + return 0; + // Returns just -1 or 1 on inequality; + return getTimeInMillis() > c.getTimeInMillis() ? 1 : -1; } } begin:vcard fn:Kendall Bell n:Bell;Kendall email;internet:[EMAIL PROTECTED] x-mozilla-html:FALSE version:2.1 end:vcard _______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Reply via email to |