/** * This method returns an instance of <code>CollationElementIterator</code> for the <code>String * </code> represented by the specified <code>CharacterIterator</code>. * * @param source The <code>CharacterIterator</code> with the desired <code>String</code>. * @return A <code>CollationElementIterator</code> for the specified <code>String</code>. */ public CollationElementIterator getCollationElementIterator(CharacterIterator source) { StringBuffer expand = new StringBuffer(""); // Right now we assume that we will read from the beginning of the string. for (char c = source.first(); c != CharacterIterator.DONE; c = source.next()) decomposeCharacter(c, expand); return getCollationElementIterator(expand.toString()); }
public World() { // Parse foobar float x = 0, y = 0; CharacterIterator it = new StringCharacterIterator(foobar); for (char ch = it.first(); ch != CharacterIterator.DONE; ch = it.next(), x++) { switch (ch) { case '+': walls.add(new Wall(new Vector2f(x + 0.5f, y), new Vector2f(x + 0.5f, y + 1.0f))); case '-': walls.add(new Wall(new Vector2f(x, y + 0.5f), new Vector2f(x + 1.0f, y + 0.5f))); break; case '|': walls.add(new Wall(new Vector2f(x + 0.5f, y), new Vector2f(x + 0.5f, y + 1.0f))); break; case '\n': x = -1; y++; break; } } singleton = this; }