diff options
author | jlquinn <jlquinn@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-07 04:18:19 +0000 |
---|---|---|
committer | jlquinn <jlquinn@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-07 04:18:19 +0000 |
commit | 02a2521426fea485bce75c23a2a072d582ac5e1a (patch) | |
tree | 4e749b7520d0384f198f66837b8b0c6fd3eb9094 /libjava | |
parent | fb4fe02df7c86b6c68f6d0cd4c79808ed4c5f6ca (diff) | |
download | gcc-02a2521426fea485bce75c23a2a072d582ac5e1a.tar.gz |
ChangeLog
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81604 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/java/util/Calendar.java | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/libjava/java/util/Calendar.java b/libjava/java/util/Calendar.java index 2a1e1d8b707..11b0aacf940 100644 --- a/libjava/java/util/Calendar.java +++ b/libjava/java/util/Calendar.java @@ -926,8 +926,21 @@ public abstract class Calendar implements Serializable, Cloneable * @return the actual minimum value. * @since jdk1.2 */ - // FIXME: XXX: Not abstract in JDK 1.2. - public abstract int getActualMinimum(int field); + public int getActualMinimum(int field) + { + Calendar tmp = (Calendar)clone(); // To avoid restoring state + int min = tmp.getGreatestMinimum(field); + int end = tmp.getMinimum(field); + tmp.set(field, min); + for (; min > end; min--) + { + tmp.add(field, -1); // Try to get smaller + if (tmp.get(field) != min - 1) + break; // Done if not successful + + } + return min; + } /** * Gets the actual maximum value that is allowed for the specified field. @@ -936,8 +949,20 @@ public abstract class Calendar implements Serializable, Cloneable * @return the actual maximum value. * @since jdk1.2 */ - // FIXME: XXX: Not abstract in JDK 1.2. - public abstract int getActualMaximum(int field); + public int getActualMaximum(int field) + { + Calendar tmp = (Calendar)clone(); // To avoid restoring state + int max = tmp.getLeastMaximum(field); + int end = tmp.getMaximum(field); + tmp.set(field, max); + for (; max < end; max++) + { + tmp.add(field, 1); + if (tmp.get(field) != max + 1) + break; + } + return max; + } /** * Return a clone of this object. |