net.sf.extjwnl.dictionary.file_manager
Interface FileManager

All Superinterfaces:
Owned
All Known Implementing Classes:
FileManagerImpl

public interface FileManager
extends Owned

FileManager defines the interface between the FileBackedDictionary and the file system. Methods in this interface operate on and return offsets, which are indices into a dictionary file.

Author:
John Didion , Aliaksandr Autayeu

Method Summary
 void close()
          Shuts down the file manager.
 void delete()
          Deletes the dictionary.
 void edit()
          Reopens files for writing.
 long getFirstLinePointer(POS pos, DictionaryFileType fileType)
          Return the first valid line pointer in the specified file.
 long getIndexedLinePointer(POS pos, DictionaryFileType fileType, String index)
          Search for the line whose first word is index (that is, that begins with index followed by a space or tab).
 long getMatchingLinePointer(POS pos, DictionaryFileType fileType, long offset, String substring)
          Search for a line whose index word contains substring, starting at offset.
 long getNextLinePointer(POS pos, DictionaryFileType fileType, long offset)
          Search for the line following the line that begins at offset.
 long getRandomLinePointer(POS pos, DictionaryFileType fileType)
          Return a randomly-chosen line pointer (offset of the beginning of a line).
 int getUseCount(String senseKey)
          Returns the number of times the sense marked by senseKey occurs in a semantic concordance.
 String readLineAt(POS pos, DictionaryFileType fileType, long offset)
          Read the line that begins at file offset offset.
 void save()
          Saves the files.
 
Methods inherited from interface net.sf.extjwnl.util.factory.Owned
getDictionary, setDictionary
 

Method Detail

getIndexedLinePointer

long getIndexedLinePointer(POS pos,
                           DictionaryFileType fileType,
                           String index)
                           throws IOException
Search for the line whose first word is index (that is, that begins with index followed by a space or tab).

Parameters:
pos - part of speech
fileType - file type
index - word to search for
Returns:
The file offset of the start of the matching line, or -1 if no such line exists.
Throws:
IOException - IOException

readLineAt

String readLineAt(POS pos,
                  DictionaryFileType fileType,
                  long offset)
                  throws IOException
Read the line that begins at file offset offset.

Parameters:
pos - part of speech
fileType - file type
offset - file offset
Returns:
the line that begins at file offset offset
Throws:
IOException - IOException

getNextLinePointer

long getNextLinePointer(POS pos,
                        DictionaryFileType fileType,
                        long offset)
                        throws IOException
Search for the line following the line that begins at offset.

Parameters:
pos - part of speech
fileType - file type
offset - file offset
Returns:
The file offset of the start of the line, or -1 if offset is the last line in the file.
Throws:
IOException - IOException

getMatchingLinePointer

long getMatchingLinePointer(POS pos,
                            DictionaryFileType fileType,
                            long offset,
                            String substring)
                            throws IOException
Search for a line whose index word contains substring, starting at offset.

Parameters:
pos - part of speech
fileType - file type
offset - file offset
substring - substring to search for in indexword
Returns:
The file offset of the start of the matching line, or -1 if no such line exists.
Throws:
IOException - IOException

getRandomLinePointer

long getRandomLinePointer(POS pos,
                          DictionaryFileType fileType)
                          throws IOException
Return a randomly-chosen line pointer (offset of the beginning of a line).

Parameters:
pos - part of speech
fileType - file type
Returns:
a randomly-chosen line pointer
Throws:
IOException - IOException

getFirstLinePointer

long getFirstLinePointer(POS pos,
                         DictionaryFileType fileType)
                         throws IOException
Return the first valid line pointer in the specified file.

Parameters:
pos - part of speech
fileType - file type
Returns:
the first valid line pointer in the specified file
Throws:
IOException - IOException

getUseCount

int getUseCount(String senseKey)
                throws IOException
Returns the number of times the sense marked by senseKey occurs in a semantic concordance.

Parameters:
senseKey - sense key
Returns:
the number of times the sense marked by senseKey occurs in a semantic concordance
Throws:
IOException - IOException

close

void close()
Shuts down the file manager.


save

void save()
          throws IOException,
                 JWNLException
Saves the files.

Throws:
IOException - IOException
JWNLException - JWNLException

delete

void delete()
            throws IOException
Deletes the dictionary.

Throws:
IOException - IOException

edit

void edit()
          throws IOException
Reopens files for writing.

Throws:
IOException - IOException


Copyright © 2011. All Rights Reserved.