net.sf.extjwnl.dictionary.file
Class AbstractDictionaryFile

java.lang.Object
  extended by net.sf.extjwnl.dictionary.file.AbstractDictionaryFile
All Implemented Interfaces:
DictionaryFile, Owned
Direct Known Subclasses:
AbstractPrincetonDictionaryFile

public abstract class AbstractDictionaryFile
extends Object
implements DictionaryFile

Abstract implementation of DictionaryFile. This class should be implemented for each file naming scheme used. It is assumed that each file will be associated with both a POS and a file type (e.g. in the windows naming scheme, the verb index file is called "verb.idx").

Author:
John Didion , Aliaksandr Autayeu

Field Summary
protected  Dictionary dictionary
           
protected  File file
           
protected  Map<String,Param> params
           
 
Constructor Summary
  AbstractDictionaryFile()
           
  AbstractDictionaryFile(Dictionary dictionary, Map<String,Param> params)
           
protected AbstractDictionaryFile(Dictionary dictionary, String path, POS pos, DictionaryFileType fileType, Map<String,Param> params)
           
 
Method Summary
 void close()
          Closes the file.
 boolean delete()
          Deletes the file.
 Dictionary getDictionary()
          Returns the dictionary this object belongs to.
 File getFile()
          Returns the file.
protected abstract  String getFilename()
          Returns a filename from the part-of-speech and the file type.
 DictionaryFileType getFileType()
          The file type associated with this file.
 POS getPOS()
          The POS associated with this file.
 void open()
          Opens the file.
protected abstract  void openFile()
          Opens the file.
 void setDictionary(Dictionary dictionary)
          Sets the dictionary this object belongs to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.extjwnl.dictionary.file.DictionaryFile
edit, isOpen, save
 

Field Detail

dictionary

protected Dictionary dictionary

params

protected Map<String,Param> params

file

protected File file
Constructor Detail

AbstractDictionaryFile

public AbstractDictionaryFile()

AbstractDictionaryFile

public AbstractDictionaryFile(Dictionary dictionary,
                              Map<String,Param> params)

AbstractDictionaryFile

protected AbstractDictionaryFile(Dictionary dictionary,
                                 String path,
                                 POS pos,
                                 DictionaryFileType fileType,
                                 Map<String,Param> params)
Method Detail

getFilename

protected abstract String getFilename()
Returns a filename from the part-of-speech and the file type.

Returns:
a filename from the part-of-speech and the file type

openFile

protected abstract void openFile()
                          throws IOException
Opens the file.

Throws:
IOException - IOException

getPOS

public POS getPOS()
The POS associated with this file.

Specified by:
getPOS in interface DictionaryFile
Returns:
the POS associated with this file

getFile

public File getFile()
Description copied from interface: DictionaryFile
Returns the file.

Specified by:
getFile in interface DictionaryFile
Returns:
the file

getFileType

public DictionaryFileType getFileType()
The file type associated with this file.

Specified by:
getFileType in interface DictionaryFile
Returns:
the file type associated with this file

open

public void open()
          throws IOException
Opens the file.

Specified by:
open in interface DictionaryFile
Throws:
IOException - IOException

close

public void close()
Description copied from interface: DictionaryFile
Closes the file.

Specified by:
close in interface DictionaryFile

delete

public boolean delete()
               throws IOException
Description copied from interface: DictionaryFile
Deletes the file.

Specified by:
delete in interface DictionaryFile
Returns:
true if succeeded
Throws:
IOException - IOException

getDictionary

public Dictionary getDictionary()
Description copied from interface: Owned
Returns the dictionary this object belongs to.

Specified by:
getDictionary in interface Owned
Returns:
the dictionary this object belongs to

setDictionary

public void setDictionary(Dictionary dictionary)
Description copied from interface: Owned
Sets the dictionary this object belongs to.

Specified by:
setDictionary in interface Owned
Parameters:
dictionary - the dictionary this object belongs to


Copyright © 2011. All Rights Reserved.