All Packages Class Hierarchy This Package Previous Next Index
Class scrobble.Dico
java.lang.Object
|
+----scrobble.Dico
- public class Dico
- extends Object
Dico.java
This class defines the dictionnary object. This object is
used to Verify that a given word is in the database.
-
averageLength
- Contains the average number of words in a dictionnary it is initialised to 50000
-
debug
- if true, enables the printing of debug informations on the console.
-
dicoFile
- Contains the name of the file that will be used as a word source
-
DicoTable
- Contains the list of all the Dictionnaries created
-
listOfWords
- Contains all the words of the dictionnary created
-
userWords
-
-
Dico(String)
- Creates a new dictionnary with the given file.
-
addWord(WordPositioner)
- Adds a given WordPositionner to the user dictionnary.
-
finalize()
- This methode uses the
unloadWords()<\code> methode when the garbage collector deletes this object.
-
giveDefinition(WordPositioner)
- Optionnal : Gives the definition of a given word
Returns a String object containing the words definition
-
isString(String)
- Checks if a given string is in the dictionnary
Returns a boolean true if the string is in the dictionnary and
false if it isn't
-
isWord(WordPositioner)
- Checks if a given word is in the dictionnary
Returns a boolean true if the word is in the dictionnary and
false if it isn't
-
loadFile()
- This method loads the words in the
dicoFile<\code> and adds them to the
listOfWords
Vector.
-
loadWords()
-
-
toString()
- Returns a string representation of the Dico.
-
unloadWords()
- This method is used to remove a link on the current dictionnary
debug
public static final boolean debug
- if true, enables the printing of debug informations on the console.
dicoFile
String dicoFile
- Contains the name of the file that will be used as a word source
listOfWords
Hashtable listOfWords
- Contains all the words of the dictionnary created
userWords
Hashtable userWords
averageLength
int averageLength
- Contains the average number of words in a dictionnary it is initialised to 50000
DicoTable
static Hashtable DicoTable
- Contains the list of all the Dictionnaries created
Dico
public Dico(String dicoFile)
- Creates a new dictionnary with the given file. The following
Files can be used :
"English.words" is English version with about 45000 words
"Little.words" is English version with about 25000 words
"French.words" is a test file for including 100 words
- Parameters:
- dicoFile - the identifier of language of the dictionnary being created
isWord
public boolean isWord(WordPositioner toBeChecked)
- Checks if a given word is in the dictionnary
Returns a boolean true if the word is in the dictionnary and
false if it isn't
- Parameters:
- toBeChecked - the WordPositionnerthat has to be checked
isString
public boolean isString(String toBeChecked)
- Checks if a given string is in the dictionnary
Returns a boolean true if the string is in the dictionnary and
false if it isn't
- Parameters:
- toBeChecked - the string that has to be checked
toString
public String toString()
- Returns a string representation of the Dico.
- Overrides:
- toString in class Object
addWord
public void addWord(WordPositioner toBeAdded)
- Adds a given WordPositionner to the user dictionnary.
The modifications will only affect the dictionnary in
use and not the file
dicoFile
.
- Parameters:
- toBeAdded - the word that must be added to the dictionnary
giveDefinition
public String giveDefinition(WordPositioner toBeDefined)
- Optionnal : Gives the definition of a given word
Returns a String object containing the words definition
- Parameters:
- toBeDefined - the word that must be defined
loadWords
void loadWords()
unloadWords
public void unloadWords()
- This method is used to remove a link on the current dictionnary
finalize
protected void finalize()
- This methode uses the
unloadWords()<\code> methode when the garbage collector deletes this object.
- Overrides:
- finalize in class Object
loadFile
void loadFile()
- This method loads the words in the
dicoFile<\code> and adds them to the
listOfWords
Vector. This function has no parameters.
All Packages Class Hierarchy This Package Previous Next Index