summaryrefslogtreecommitdiffstats
path: root/libjava/java/text
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-21 12:42:26 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-21 12:42:26 +0000
commitac2332a1b2069afb475bbcab80f227b240cf87af (patch)
treea6fa0c9f0fdd054674395836f55efab40ef19fe3 /libjava/java/text
parent052fc805ce8f2bbb63f2b8ab0f47e04e239ecf6a (diff)
downloadppe42-gcc-ac2332a1b2069afb475bbcab80f227b240cf87af.tar.gz
ppe42-gcc-ac2332a1b2069afb475bbcab80f227b240cf87af.zip
2003-06-21 Michael Koch <konqueror@gmx.de>
* java/text/DateFormat.java, java/text/SimpleDateFormat.java, java/util/Locale.java: New versions from classpath. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68300 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/text')
-rw-r--r--libjava/java/text/DateFormat.java14
-rw-r--r--libjava/java/text/SimpleDateFormat.java15
2 files changed, 21 insertions, 8 deletions
diff --git a/libjava/java/text/DateFormat.java b/libjava/java/text/DateFormat.java
index c298ef23342..df2b270e4f3 100644
--- a/libjava/java/text/DateFormat.java
+++ b/libjava/java/text/DateFormat.java
@@ -101,7 +101,7 @@ public abstract class DateFormat extends Format implements Cloneable
* <ul>
* <li>Is not <code>null</code>.
* <li>Is an instance of <code>DateFormat</code>.
- * <li>Has the same calendar and numberFormat field values as this object.
+ * <li>Has the same numberFormat field value as this object.
* </ul>
*
* @param obj The object to test for equality against.
@@ -111,10 +111,12 @@ public abstract class DateFormat extends Format implements Cloneable
*/
public boolean equals (Object obj)
{
- if (! (obj instanceof DateFormat))
+ if (!(obj instanceof DateFormat))
return false;
+
DateFormat d = (DateFormat) obj;
- return calendar.equals(d.calendar) && numberFormat.equals(d.numberFormat);
+
+ return numberFormat.equals(d.numberFormat);
}
/**
@@ -467,10 +469,10 @@ public abstract class DateFormat extends Format implements Cloneable
*/
public int hashCode ()
{
- int hash = calendar.hashCode();
if (numberFormat != null)
- hash ^= numberFormat.hashCode();
- return hash;
+ return numberFormat.hashCode();
+ else
+ return 0;
}
/**
diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java
index 7b282f3c62f..67523e1628d 100644
--- a/libjava/java/text/SimpleDateFormat.java
+++ b/libjava/java/text/SimpleDateFormat.java
@@ -384,10 +384,10 @@ public class SimpleDateFormat extends DateFormat
SimpleDateFormat sdf = (SimpleDateFormat)o;
- if (!toPattern().equals(sdf.toPattern()))
+ if (defaultCentury != sdf.defaultCentury)
return false;
- if (!get2DigitYearStart().equals(sdf.get2DigitYearStart()))
+ if (!toPattern().equals(sdf.toPattern()))
return false;
if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols()))
@@ -396,6 +396,17 @@ public class SimpleDateFormat extends DateFormat
return true;
}
+ /**
+ * This method returns a hash value for this object.
+ *
+ * @return A hash value for this object.
+ */
+ public int hashCode()
+ {
+ return super.hashCode() ^ toPattern().hashCode() ^ defaultCentury ^
+ getDateFormatSymbols().hashCode();
+ }
+
/**
* Formats the date input according to the format string in use,
OpenPOWER on IntegriCloud