source: trunk/gcc/libjava/java/text/CollationElementIterator.java

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1// CollationElementIterator.java - Iterate over decomposed characters.
2
3/* Copyright (C) 1999, 2001 Free Software Foundation
4
5 This file is part of libgcj.
6
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
11package java.text;
12
13/**
14 * @author Tom Tromey <tromey@cygnus.com>
15 * @date March 25, 1999
16 */
17/* Written using "Java Class Libraries", 2nd edition, plus online
18 * API docs for JDK 1.2 from http://www.javasoft.com.
19 * Status: Believed complete and correct to JDK 1.1.
20 */
21
22public final class CollationElementIterator
23{
24 public static final int NULLORDER = 0xffffffff;
25
26 public int next ()
27 {
28 if (index == text.length())
29 return NULLORDER;
30 return collator.ceiNext(this);
31 }
32
33 // This one returns int while the others return short.
34 public static final int primaryOrder (int order)
35 {
36 // From the JDK 1.2 spec.
37 return order >>> 16;
38 }
39
40 public void reset ()
41 {
42 index = 0;
43 }
44
45 public static final short secondaryOrder (int order)
46 {
47 // From the JDK 1.2 spec.
48 return (short) ((order >>> 8) & 255);
49 }
50
51 public static final short tertiaryOrder (int order)
52 {
53 // From the JDK 1.2 spec.
54 return (short) (order & 255);
55 }
56
57 // Non-public constructor.
58 CollationElementIterator (String text, RuleBasedCollator collator)
59 {
60 this.text = text;
61 this.index = 0;
62 this.lookahead_set = false;
63 this.lookahead = 0;
64 this.collator = collator;
65 }
66
67 // Text over which we iterate.
68 String text;
69
70 // Index of next character to examine in TEXT.
71 int index;
72
73 // A piece of lookahead.
74 boolean lookahead_set;
75 int lookahead;
76
77 // The RuleBasedCollator which created this object.
78 RuleBasedCollator collator;
79}
Note: See TracBrowser for help on using the repository browser.