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.


Variable Index

 o averageLength
Contains the average number of words in a dictionnary it is initialised to 50000
 o debug
if true, enables the printing of debug informations on the console.
 o dicoFile
Contains the name of the file that will be used as a word source
 o DicoTable
Contains the list of all the Dictionnaries created
 o listOfWords
Contains all the words of the dictionnary created
 o userWords

Constructor Index

 o Dico(String)
Creates a new dictionnary with the given file.

Method Index

 o addWord(WordPositioner)
Adds a given WordPositionner to the user dictionnary.
 o finalize()
This methode uses the unloadWords()<\code> methode when the garbage collector deletes this object.
 o giveDefinition(WordPositioner)
Optionnal : Gives the definition of a given word Returns a String object containing the words definition
 o 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
 o 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
 o loadFile()
This method loads the words in the dicoFile<\code> and adds them to the listOfWords Vector.
 o loadWords()
 o toString()
Returns a string representation of the Dico.
 o unloadWords()
This method is used to remove a link on the current dictionnary

Variables

 o debug
 public static final boolean debug
if true, enables the printing of debug informations on the console.

 o dicoFile
 String dicoFile
Contains the name of the file that will be used as a word source

 o listOfWords
 Hashtable listOfWords
Contains all the words of the dictionnary created

 o userWords
 Hashtable userWords
 o averageLength
 int averageLength
Contains the average number of words in a dictionnary it is initialised to 50000

 o DicoTable
 static Hashtable DicoTable
Contains the list of all the Dictionnaries created

Constructors

 o 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

Methods

 o 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
 o 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
 o toString
 public String toString()
Returns a string representation of the Dico.

Overrides:
toString in class Object
 o 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
 o 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
 o loadWords
 void loadWords()
 o unloadWords
 public void unloadWords()
This method is used to remove a link on the current dictionnary

 o finalize
 protected void finalize()
This methode uses the unloadWords()<\code> methode when the garbage collector deletes this object.

Overrides:
finalize in class Object
 o 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