summaryrefslogtreecommitdiff
path: root/libjava/java/text/CollationElementIterator.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>1999-04-26 15:34:44 +0000
committerTom Tromey <tromey@gcc.gnu.org>1999-04-26 15:34:44 +0000
commit3cc26081445329aec4d4711d69c0d86e05af841b (patch)
treea49553afea7d22437a2921c9b7915e6152eb4206 /libjava/java/text/CollationElementIterator.java
parentd5d9a8b6c3dce9425129aa7ee9bd5ab69ae27c2a (diff)
GregorianCalendar.java (setDefaultTime): New method.
* java/util/GregorianCalendar.java (setDefaultTime): New method. (GregorianCalendar): Use it in all constructors. * java/util/Calendar.java (Calendar): Changed argument name to `zone' to match code. * gnu/gcj/text/LocaleData_en.java: Added collatorRule element. * java/text/CollationKey.java: New file. * java/text/CollationElementIterator.java: New file. * java/text/Collator.java: New file. * java/text/RuleBasedCollator.java: New file. From-SVN: r26654
Diffstat (limited to 'libjava/java/text/CollationElementIterator.java')
-rw-r--r--libjava/java/text/CollationElementIterator.java75
1 files changed, 75 insertions, 0 deletions
diff --git a/libjava/java/text/CollationElementIterator.java b/libjava/java/text/CollationElementIterator.java
new file mode 100644
index 00000000000..a6546294b87
--- /dev/null
+++ b/libjava/java/text/CollationElementIterator.java
@@ -0,0 +1,75 @@
+// CollationElementIterator.java - Iterate over decomposed characters.
+
+/* Copyright (C) 1999 Cygnus Solutions
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package java.text;
+
+/**
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @date March 25, 1999
+ */
+/* Written using "Java Class Libraries", 2nd edition, plus online
+ * API docs for JDK 1.2 from http://www.javasoft.com.
+ * Status: Believed complete and correct to JDK 1.1.
+ */
+
+public final class CollationElementIterator
+{
+ public static final int NULLORDER = 0xffffffff;
+
+ public int next ()
+ {
+ if (index == text.length())
+ return NULLORDER;
+ return RuleBasedCollator.ceiNext(this);
+ }
+
+ // This one returns int while the others return short.
+ public static final int primaryOrder (int order)
+ {
+ // From the JDK 1.2 spec.
+ return order >>> 16;
+ }
+
+ public void reset ()
+ {
+ index = 0;
+ }
+
+ public static final short secondaryOrder (int order)
+ {
+ // From the JDK 1.2 spec.
+ return (order >>> 8) & 255;
+ }
+
+ public static final short tertiaryOrder (int order)
+ {
+ // From the JDK 1.2 spec.
+ return order & 255;
+ }
+
+ // Non-public constructor.
+ CollationElementIterator (String text)
+ {
+ this.text = text;
+ this.index = 0;
+ this.lookahead_set = false;
+ this.lookahead = 0;
+ }
+
+ // Text over which we iterate.
+ String text;
+
+ // Index of next character to examine in TEXT.
+ int index;
+
+ // A piece of lookahead.
+ boolean lookahead_set;
+ int lookahead;
+}