classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Re: [cp-patches] Comparable in java.util.Calendar]


From: Kendall Bell
Subject: [Fwd: Re: [cp-patches] Comparable in java.util.Calendar]
Date: Fri, 25 Nov 2005 20:38:04 -0600
User-agent: Thunderbird 1.5 (X11/20051025)



-------- Original Message --------
From: - Thu Nov 24 10:35:50 2005
X-Account-Key: account2
X-UIDL: 20051124083124F859
X-Mozilla-Status: 0011
X-Mozilla-Status2: 10000000
Received: from gnu.wildebeest.org ([83.160.152.237]) by mx252d.mysite4now.com (Webhost4life Mail Server v8.0) with ESMTP id BBC96819 for <address@hidden>; Thu, 24 Nov 2005 08:30:19 -0800
Received: from elsschot.wildebeest.org ([192.168.1.26]) by gnu.wildebeest.org with esmtp (Exim 3.36 #1 (Debian)) id 1EfJyb-0002VD-00 for <address@hidden>; Thu, 24 Nov 2005 17:29:37 +0100
Subject: Re: [cp-patches] Comparable in java.util.Calendar
From: Mark Wielaard <address@hidden>
To: Kendall Bell <address@hidden>
In-Reply-To: <address@hidden>
References: <address@hidden> <address@hidden> <address@hidden>
Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-O8UYY/78d1eZpP5OV/tk"
Date: Thu, 24 Nov 2005 17:29:37 +0100
Message-Id: <address@hidden>
Mime-Version: 1.0
X-Mailer: Evolution 2.2.3
X-Spam-Status: No, hits=0.01 required=3.00 tests=NO_RDNS2 version=3.1
X-Spam-Level:
X-Spam-Checker-Version: SpamAssassin 3.1 (1.5) on mx252d.mysite4now.com


Hi Kendall,

On Tue, 2005-11-22 at 09:55 -0600, Kendall Bell wrote:
> 2005-11-21  Kendall Bell  <address@hidden>
> 
> 	* 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?

Subject: 
Lots of email bounces/unsubscribes
Date: Thu, 24 Nov 2005 16:37:18 +0100
Hi,

I am seeing a lot of list traffic bounce and/or people being
unsubscribed because spamcop.net has lists.gnu.org in its RBL. If you
are (indirectly through your ISP) using spamcop you will probably not
receive this email. But I post it anyway for people reading the archives
after they have discovered their mail server has been blocking any
gnu.org emails.

I asked the savannah-hackers and gnu.org sysadmins to investigate but
till it has been resolved it would be good to not use the spamcop RBL.

Cheers,

Mark

-- 
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html

Join the community at http://planet.classpath.org/

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---

Attachment: signature.asc
Description: PGP signature

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;
   }
 }

Attachment: kendall.vcf
Description: Vcard


reply via email to

[Prev in Thread] Current Thread [Next in Thread]