| com.sun.midp.chameleon.input.PTIterator
All known Subclasses: com.sun.midp.chameleon.input.PTIteratorImpl,
PTIterator | public interface PTIterator (Code) | | 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
|
Method Summary | |
public boolean | hasNext() Returns true if the iteration has more elements. | public String | next() Returns the next element in the iteration. | public void | nextLevel(int keyCode) | public void | prevLevel() | public void | reset() | public void | resetNext() Revert to first possible completion. |
hasNext | public boolean hasNext()(Code) | | Returns true if the iteration has more elements. (In other words,
returns true if next would return an
element rather than throwing an exception.)
true if the iterator has more elements. |
next | public String next()(Code) | | Returns the next element in the iteration.
next element in the iteration. exception: NoSuchElementException - iteration has no more elements. |
nextLevel | public void nextLevel(int keyCode)(Code) | | add a key to current completion string
Parameters: keyCode - char in the range '0'-'9', '#', or '*' |
prevLevel | public void prevLevel()(Code) | | backspace on key in current completion string
|
reset | public void reset()(Code) | | create a new handle and clear completion state by calling
ptNewIterator0()
|
resetNext | public void resetNext()(Code) | | 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
|
|
|