Package net.didion.jwnl.dictionary.file
Class AbstractDictionaryFile
- java.lang.Object
-
- net.didion.jwnl.dictionary.file.AbstractDictionaryFile
-
- All Implemented Interfaces:
DictionaryFile
- Direct Known Subclasses:
AbstractPrincetonDictionaryFile
public abstract class AbstractDictionaryFile extends java.lang.Object implements DictionaryFile
Abstract implementation ofDictionaryFile. 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").
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.File_fileprivate DictionaryFileType_fileTypeThe type of the file.private POS_pos-
Fields inherited from interface net.didion.jwnl.dictionary.file.DictionaryFile
COMMENT_HEADER
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractDictionaryFile()protectedAbstractDictionaryFile(java.lang.String path, POS pos, DictionaryFileType fileType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.io.FilegetFile()DictionaryFileTypegetFileType()The file type associated with this file.POSgetPOS()The POS associated with this file.protected abstract java.lang.StringmakeFilename()Build a filename from the part-of-speech and the file type.voidopen()Open the file.protected abstract voidopenFile(java.io.File file)Open the file at pathpath-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.didion.jwnl.dictionary.file.DictionaryFile
close, isOpen, newInstance
-
-
-
-
Field Detail
-
_pos
private POS _pos
-
_fileType
private DictionaryFileType _fileType
The type of the file. For example, the default implementation defines the types INDEX, DATA, and EXCEPTION.
-
_file
private java.io.File _file
-
-
Constructor Detail
-
AbstractDictionaryFile
public AbstractDictionaryFile()
-
AbstractDictionaryFile
protected AbstractDictionaryFile(java.lang.String path, POS pos, DictionaryFileType fileType)
-
-
Method Detail
-
makeFilename
protected abstract java.lang.String makeFilename()
Build a filename from the part-of-speech and the file type.
-
openFile
protected abstract void openFile(java.io.File file) throws java.io.IOExceptionOpen the file at pathpath- Throws:
java.io.IOException
-
getPOS
public POS getPOS()
The POS associated with this file.- Specified by:
getPOSin interfaceDictionaryFile
-
getFile
public java.io.File getFile()
- Specified by:
getFilein interfaceDictionaryFile
-
getFileType
public DictionaryFileType getFileType()
The file type associated with this file.- Specified by:
getFileTypein interfaceDictionaryFile
-
open
public void open() throws java.io.IOExceptionOpen the file.- Specified by:
openin interfaceDictionaryFile- Throws:
java.io.IOException
-
-