ar.com.ktulu.dict
Class FileDatabase

java.lang.Object
  |
  +--ar.com.ktulu.dict.Database
        |
        +--ar.com.ktulu.dict.FileDatabase

public class FileDatabase
extends Database

Support for dictionaries stored in flat text files.

Author:
Luis Parravicini

Constructor Summary
FileDatabase(java.lang.String name, java.lang.String fdb, java.lang.String fidx)
           
 
Method Summary
 Matches define(java.lang.String word)
          Used by the server to process a "DEFINE" command.
 Definition getWordDefinition(Key k)
          Returns the definition of the word stored in k.
protected  void initKeys()
          Reads the index into memory.
 int keySize()
          Returns the number of headwords in the database.
 Matches match(java.lang.String word, Strategy strat)
          Used by the server to process a "MATCH" command.
 
Methods inherited from class ar.com.ktulu.dict.Database
getInfo, getName, getProperty, getProperty, getShortInfo, setInfo, setName, setShortInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDatabase

public FileDatabase(java.lang.String name,
                    java.lang.String fdb,
                    java.lang.String fidx)
             throws DatabaseException
Method Detail

initKeys

protected void initKeys()
                 throws java.io.IOException
Reads the index into memory. For this, it puts all the headwords into a KeyList.

java.io.IOException
See Also:
KeyList

keySize

public int keySize()
Description copied from class: Database
Returns the number of headwords in the database.

Specified by:
keySize in class Database

define

public Matches define(java.lang.String word)
Description copied from class: Database
Used by the server to process a "DEFINE" command.

Specified by:
define in class Database

match

public Matches match(java.lang.String word,
                     Strategy strat)
              throws DatabaseException
Description copied from class: Database
Used by the server to process a "MATCH" command.

Specified by:
match in class Database
DatabaseException

getWordDefinition

public Definition getWordDefinition(Key k)
                             throws DatabaseException
Description copied from class: Database
Returns the definition of the word stored in k.

Specified by:
getWordDefinition in class Database
DatabaseException