This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Patch: java.text.CollationElementIterator


Hi list,


I commited the attached patch which adds a new method from classpath to trunk.


Michael


2004-01-23  Michael Koch  <konqueror@gmx.de>

	* java/text/CollationElementIterator.java:
	(setText): New method.

Index: java/text/CollationElementIterator.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/CollationElementIterator.java,v
retrieving revision 1.10
diff -u -b -B -r1.10 CollationElementIterator.java
--- java/text/CollationElementIterator.java	7 Jan 2004 18:40:07 -0000	1.10
+++ java/text/CollationElementIterator.java	23 Jan 2004 15:15:19 -0000
@@ -1,5 +1,5 @@
 /* CollationElementIterator.java -- Walks through collation elements
-   Copyright (C) 1998, 1999, 2001, 2002, 2003  Free Software Foundation
+   Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004  Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -178,6 +178,27 @@
     this.textIndex = 0;
     this.lookahead_set = false;
     this.lookahead = 0;
+  }
+
+  /**
+   * This method sets the <code>String</code> that it is iterating over
+   * to the <code>String</code> represented by the specified
+   * <code>CharacterIterator</code>.
+   *
+   * @param source The <code>CharacterIterator</code> containing the new
+   * <code>String</code> to iterate over.
+   */
+  public void setText(CharacterIterator source)
+  {
+    StringBuffer expand = new StringBuffer();
+
+    // For now assume we read from the beginning of the string.
+    for (char c = source.first();
+	 c != CharacterIterator.DONE;
+	 c = source.next())
+      expand.append(c);
+
+    setText(expand.toString());
   }
 
   /**

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]