diff options
author | Michael Koch <konqueror@gmx.de> | 2004-01-07 18:40:08 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2004-01-07 18:40:08 +0000 |
commit | 9b773289f883bc57491f8254e7ece335ae948f7e (patch) | |
tree | 195faa2550e69c0ed1060d2bf90a2b1c688588a5 /libjava/java/text/CollationKey.java | |
parent | 677e7ddceed691a4453804e97bb9733e53d4ea4d (diff) | |
download | gcc-9b773289f883bc57491f8254e7ece335ae948f7e.zip gcc-9b773289f883bc57491f8254e7ece335ae948f7e.tar.gz gcc-9b773289f883bc57491f8254e7ece335ae948f7e.tar.bz2 |
2004-01-07 Michael Koch <konqueror@gmx.de>
* java/text/CollationElementIterator.java
(textIndex): Renamed from index.
* java/text/CollationKey.java
(collator): New member.
(CollationKey): New argument for parent collator.
(equals): Check for same collator, source string and key array.
* java/text/RuleBasedCollator.java:
Reformated.
(RuleBasedCollator): Don't re-initialize frenchAccents with default
value.
(getCollationElementIterator): Rewritten.
(getCollationKey): Added new argument to CollationKey constructor.
From-SVN: r75510
Diffstat (limited to 'libjava/java/text/CollationKey.java')
-rw-r--r-- | libjava/java/text/CollationKey.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libjava/java/text/CollationKey.java b/libjava/java/text/CollationKey.java index f7e3148..8859b32 100644 --- a/libjava/java/text/CollationKey.java +++ b/libjava/java/text/CollationKey.java @@ -66,6 +66,11 @@ package java.text; public final class CollationKey implements Comparable { /** + * This is the <code>Collator</code> this object was created from. + */ + private Collator collator; + + /** * This is the <code>String</code> this object represents. */ private String originalText; @@ -75,9 +80,10 @@ public final class CollationKey implements Comparable */ private int[] key; - CollationKey (CollationElementIterator iter, String originalText, - int strength) + CollationKey(Collator collator, CollationElementIterator iter, + String originalText, int strength) { + this.collator = collator; this.originalText = originalText; // Compute size of required array. @@ -153,12 +159,14 @@ public final class CollationKey implements Comparable CollationKey ck = (CollationKey) obj; - if (key.length != ck.key.length) + if (ck.collator != collator) return false; - for (int i = 0; i < key.length; ++i) - if (key[i] != ck.key[i]) - return false; + if (!ck.getSourceString ().equals (getSourceString ())) + return false; + + if (!ck.toByteArray ().equals (toByteArray ())) + return false; return true; } |