/[classpath]/classpath/java/util/Calendar.java
ViewVC logotype

Diff of /classpath/java/util/Calendar.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25.2.13 by gnu_andrew, Sun Mar 13 14:38:42 2005 UTC revision 1.25.2.14 by gnu_andrew, Tue Apr 19 23:17:10 2005 UTC
# Line 1176  public abstract class Calendar Line 1176  public abstract class Calendar
1176      return max;      return max;
1177    }    }
1178    
1179    public int compareTo(Calendar other)    /**
1180       * Compares the time of two calendar instances.
1181       * @param calendar the calendar to which the time should be compared.
1182       * @return 0 if the two calendars are set to the same time,
1183       * less than 0 if the time of this calendar is before that of
1184       * <code>cal</code>, or more than 0 if the time of this calendar is after
1185       * that of <code>cal</code>.
1186       *
1187       * @param cal the calendar to compare this instance with.
1188       * @throws NullPointerException if <code>cal</code> is null.
1189       * @throws IllegalArgumentException if either calendar has fields set to
1190       * invalid values.
1191       * @since 1.5
1192       */
1193      public int compareTo(Calendar cal)
1194    {    {
1195      if (time < other.time)      long t1 = getTimeInMillis();
1196        return -1;      long t2 = cal.getTimeInMillis();
1197      return time == other.time ? 0 : 1;      if(t1 == t2)
1198          return 0;
1199        if(t1 > t2)
1200          return 1;
1201        return -1;
1202    }    }
1203    
1204    /**    /**

Legend:
Removed from v.1.25.2.13  
changed lines
  Added in v.1.25.2.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26