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

2005-12-02 Thread Mark Wielaard
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://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/util/Calendar.java?only_with_tag=generics-branch

I see your paperwork has gone through and the mailinglist seems to
function again. Have you had time to compare the two implementations?

Thanks,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


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

2005-11-25 Thread Kendall Bell






 Original Message 

  

  From: 
  - Thu Nov 24 10:35:50 2005


  X-Account-Key:
  
  account2


  X-UIDL: 
  20051124083124F859


  X-Mozilla-Status:
  
  0011


  X-Mozilla-Status2:
  
  1000


  Received: 
  from gnu.wildebeest.org ([83.160.152.237]) by
mx252d.mysite4now.com (Webhost4life Mail Server v8.0) with ESMTP id
BBC96819 for [EMAIL PROTECTED]; 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 [EMAIL PROTECTED]; Thu, 24 Nov 2005
17:29:37 +0100


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


  From: 
  Mark Wielaard [EMAIL PROTECTED]


  To: 
  Kendall Bell [EMAIL PROTECTED]


  In-Reply-To: 
  [EMAIL PROTECTED]


  References: 
  [EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]


  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: 
  [EMAIL PROTECTED]


  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  [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
Description: This is a digitally signed message part
---End Message---


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 -   1.47
+++ classpath/java/util/Calendar.java   22 Nov 2005 15:40:58 -
@@ -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