ft
Class FTDictionary

java.lang.Object
  |
  +--ft.FTDictionary

public class FTDictionary
extends java.lang.Object

A class for FT dictionary. For example:

    dir = new FTDictionary();
    File file = new File("dictionary_file.zip");
    dir.loadDictionary(file);
 


Constructor Summary
FTDictionary()
          Create and initialize new FT dictionary.
 
Method Summary
 void addWord(java.lang.String word)
          Add word to dictionary.
 FTIterator iterator()
          Returns an iterator over the elements in this collection.
 void loadDictionary(java.io.File file)
          Loads new dictionary file.
 java.lang.String searchFullWord(int[] keys)
          Search whole word that matches whole word.
 void sort()
          Sort dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FTDictionary

public FTDictionary()
Create and initialize new FT dictionary.

Method Detail

loadDictionary

public void loadDictionary(java.io.File file)
                    throws java.io.FileNotFoundException
Loads new dictionary file. File could be plain ascii or zip-file.

Parameters:
file - File to be loaded.
Throws:
java.io.FileNotFoundException - if file could not be opened.

iterator

public FTIterator iterator()
Returns an iterator over the elements in this collection.

Returns:
FTIterator to use in iteration.

searchFullWord

public java.lang.String searchFullWord(int[] keys)
Search whole word that matches whole word.

Parameters:
keys - Array of keys. For example {4,3,5,5,6} could return word "Hello" (of course depending on used dictionary).
Returns:
null if word is not found.

addWord

public void addWord(java.lang.String word)
Add word to dictionary.

Parameters:
word - Word to be added to dictionary.

sort

public void sort()
Sort dictionary. This should be used after all words are added to FTDictionary. This called automatically in loadDictionary(File) after loading.



Markku Korsumäki 2003 code::web