summaryrefslogtreecommitdiffstats
path: root/libjava/java/text/CollationElementIterator.java
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-15 14:49:30 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-15 14:49:30 +0000
commit5daa75180b41b455bae3333909ccfae4396728d4 (patch)
treed37af84b93a0c1b9be35c9c0a07868d393fb9e79 /libjava/java/text/CollationElementIterator.java
parent5d8c3937f317b1844808695c58155489e8245f2a (diff)
downloadppe42-gcc-5daa75180b41b455bae3333909ccfae4396728d4.tar.gz
ppe42-gcc-5daa75180b41b455bae3333909ccfae4396728d4.zip
2003-10-15 Michael Koch <konqueror@gmx.de>
* java/text/CollationElementIterator.java (CollationElementIterator): Moved, documenatation added, call setText. (next): Reformated. (reset): Reformated. (setText): New method. (getOffset): New method. * java/text/CollationKey.java (getSourceString): Reformated. (hashCode): Reformated. (toByteArray): Reformated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72523 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/text/CollationElementIterator.java')
-rw-r--r--libjava/java/text/CollationElementIterator.java45
1 files changed, 39 insertions, 6 deletions
diff --git a/libjava/java/text/CollationElementIterator.java b/libjava/java/text/CollationElementIterator.java
index 94c65005e8f..9eb17a50148 100644
--- a/libjava/java/text/CollationElementIterator.java
+++ b/libjava/java/text/CollationElementIterator.java
@@ -82,18 +82,32 @@ public final class CollationElementIterator
int lookahead;
/**
+ * This method initializes a new instance of <code>CollationElementIterator</code>
+ * to iterate over the specified <code>String</code> using the rules in the
+ * specified <code>RuleBasedCollator</code>.
+ *
+ * @param collator The <code>RuleBasedCollation</code> used for calculating collation values
+ * @param text The <code>String</code> to iterate over.
+ */
+ CollationElementIterator (String text, RuleBasedCollator collator)
+ {
+ setText (text);
+ this.collator = collator;
+ }
+
+ /**
* This method returns the collation ordering value of the next character
* in the string. This method will return <code>NULLORDER</code> if the
* end of the string was reached.
*
* @return The collation ordering value.
*/
- public int next ()
+ public int next()
{
if (index == text.length())
return NULLORDER;
- return collator.ceiNext(this);
+ return collator.ceiNext (this);
}
/**
@@ -114,7 +128,7 @@ public final class CollationElementIterator
* This method resets the internal position pointer to read from the
* beginning of the <code>String again.
*/
- public void reset ()
+ public void reset()
{
index = 0;
}
@@ -147,14 +161,33 @@ public final class CollationElementIterator
return (short) (order & 255);
}
- // Non-public constructor.
- CollationElementIterator (String text, RuleBasedCollator collator)
+ /**
+ * This method sets the <code>String</code> that it is iterating over
+ * to the specified <code>String</code>.
+ *
+ * @param text The new <code>String</code> to iterate over.
+ *
+ * @since 1.2
+ */
+ public void setText (String text)
{
this.text = text;
this.index = 0;
this.lookahead_set = false;
this.lookahead = 0;
- this.collator = collator;
+ }
+
+ /**
+ * This method returns the current offset into the <code>String</code>
+ * that is being iterated over.
+ *
+ * @return The iteration index position.
+ *
+ * @since 1.2
+ */
+ public int getOffset()
+ {
+ return index;
}
} // class CollationElementIterator
OpenPOWER on IntegriCloud