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
This commit is contained in:
Michael Koch 2004-01-07 18:40:08 +00:00 committed by Michael Koch
parent 677e7ddcee
commit 9b773289f8
4 changed files with 57 additions and 31 deletions

View file

@ -65,6 +65,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.
*/
@ -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;
}