FileDocCategorySizeDatePackage
PTIterator.javaAPI DocphoneME MR2 API (J2ME)3448Wed May 02 18:00:20 BST 2007com.sun.midp.chameleon.input

PTIterator

public interface PTIterator
Aniterator that provides predictive text browsing capabilities Requires only single word predictive text librray support. Traversal is done by using nextLevel(keyCode) to enter keys and next() to get possible completions. Exmaple of using predictive text iterators: PTDictionary dictionary; Iterator iter=dictionary.iterator(); iter.nextLevel('2'); iter.nextLevel('2'); iter.nextLevel('2'); while(iter.hasNext()) { String completion=iter.next(); System.out.println(completion); //will print "aca" (short of "academy") "cab" (short of "cabin"), // "acc" (short of "accelerate") etc. } PTIterator operations: next() : get next possible completion string hasNext() : check if another possible completion exists nextLevel(int key) : add a char to the current completion prevLevel() : backspace last char from current completion reset() : clear current completion resetNext() : revert to first possible completion string

Fields Summary
Constructors Summary
Methods Summary
public booleanhasNext()
Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

return
true if the iterator has more elements.

public java.lang.Stringnext()
Returns the next element in the iteration.

return
next element in the iteration.
exception
NoSuchElementException iteration has no more elements.

public voidnextLevel(int keyCode)
add a key to current completion string

param
keyCode char in the range '0'-'9', '#', or '*'

public voidprevLevel()
backspace on key in current completion string

public voidreset()
create a new handle and clear completion state by calling ptNewIterator0()

public voidresetNext()
Revert to first possible completion. If next() has been called uptil hasNext() returns false, then after calling resetNext(), calling next() will return the 1st completion