net.sf.extjwnl.dictionary
Class AbstractCachingDictionary

java.lang.Object
  extended by net.sf.extjwnl.dictionary.Dictionary
      extended by net.sf.extjwnl.dictionary.AbstractCachingDictionary
Direct Known Subclasses:
DatabaseBackedDictionary, FileBackedDictionary

public abstract class AbstractCachingDictionary
extends Dictionary

Extends Dictionary to provide caching of elements.

Author:
John Didion ,

Nested Class Summary
static class AbstractCachingDictionary.IndexWordIterator
           
 
Nested classes/interfaces inherited from class net.sf.extjwnl.dictionary.Dictionary
Dictionary.Version
 
Field Summary
protected  boolean isCachingEnabled
           
 
Fields inherited from class net.sf.extjwnl.dictionary.Dictionary
CHECK_LEX_IDS_KEY, EDIT_CHECK_ALIEN_POINTERS, EDIT_MANAGE_SYMMETRIC_POINTERS, maxOffset, MORPH, params
 
Constructor Summary
protected AbstractCachingDictionary(Document doc)
           
 
Method Summary
 void addException(Exc exc)
          Adds exception to the dictionary.
 void addIndexWord(IndexWord indexWord)
          Adds index word to the dictionary.
 void addSynset(Synset synset)
          Adds synset to the dictionary.
 void cacheAll()
           
protected  void cacheException(Exc exception)
           
protected  void cacheIndexWord(IndexWord word)
           
protected  void cachePOS(POS pos)
           
 void cacheSynset(Synset synset)
           
 void clearCache()
           
 void clearCache(DictionaryElementType elementType)
           
protected  void clearException(POS pos, Object key)
           
protected  void clearIndexWord(POS pos, Object key)
           
 void clearSynset(POS pos, Object key)
           
 void edit()
          Puts the dictionary into edit mode.
 long getCacheCapacity(DictionaryElementType type)
           
protected  Exc getCachedException(POS pos, Object key)
           
protected  IndexWord getCachedIndexWord(POS pos, Object key)
           
protected  Synset getCachedSynset(POS pos, Object key)
           
 int getCacheSizes(DictionaryElementType type)
           
 Iterator<Exc> getExceptionIterator(POS pos)
          Returns an Iterator over all the Exceptions in the database.
 Iterator<IndexWord> getIndexWordIterator(POS pos)
          Returns an Iterator over all the IndexWords of part-of-speech pos in the database.
 Iterator<IndexWord> getIndexWordIterator(POS pos, String substring)
          Returns an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.
 Iterator<Synset> getSynsetIterator(POS pos)
          Returns an Iterator over all the Synsets of part-of-speech pos in the database.
 boolean isCachingEnabled()
           
 void removeException(Exc exc)
          Removes the exc from the dictionary.
 void removeIndexWord(IndexWord indexWord)
          Removes indexWord from the dictionary.
 void removeSynset(Synset synset)
          Removes synset from the dictionary.
 void setCacheCapacity(DictionaryElementType type, int size)
           
 void setCacheCapacity(int size)
           
 void setCachingEnabled(boolean cachingEnabled)
           
 
Methods inherited from class net.sf.extjwnl.dictionary.Dictionary
addElement, close, createException, createIndexWord, createSynset, delete, getCheckAlienPointers, getDatabaseBackedInstance, getException, getFileBackedInstance, getIndexWord, getInstance, getInstance, getInstance, getManageSymmetricPointers, getMapBackedInstance, getMorphologicalProcessor, getRandomIndexWord, getRestoreDictionary, getSynsetAt, getVersion, getWordBySenseKey, isEditable, lookupAllIndexWords, lookupIndexWord, prepareQueryString, removeElement, save, setInstance, setRestoreDictionary, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isCachingEnabled

protected boolean isCachingEnabled
Constructor Detail

AbstractCachingDictionary

protected AbstractCachingDictionary(Document doc)
                             throws JWNLException
Throws:
JWNLException
Method Detail

isCachingEnabled

public boolean isCachingEnabled()

setCachingEnabled

public void setCachingEnabled(boolean cachingEnabled)

getCacheSizes

public int getCacheSizes(DictionaryElementType type)

getCacheCapacity

public long getCacheCapacity(DictionaryElementType type)

setCacheCapacity

public void setCacheCapacity(int size)

setCacheCapacity

public void setCacheCapacity(DictionaryElementType type,
                             int size)

clearCache

public void clearCache()

clearCache

public void clearCache(DictionaryElementType elementType)

cacheIndexWord

protected void cacheIndexWord(IndexWord word)

clearIndexWord

protected void clearIndexWord(POS pos,
                              Object key)

getCachedIndexWord

protected IndexWord getCachedIndexWord(POS pos,
                                       Object key)

cacheSynset

public void cacheSynset(Synset synset)

clearSynset

public void clearSynset(POS pos,
                        Object key)

getCachedSynset

protected Synset getCachedSynset(POS pos,
                                 Object key)

cacheException

protected void cacheException(Exc exception)

clearException

protected void clearException(POS pos,
                              Object key)

getCachedException

protected Exc getCachedException(POS pos,
                                 Object key)

getExceptionIterator

public Iterator<Exc> getExceptionIterator(POS pos)
                                   throws JWNLException
Description copied from class: Dictionary
Returns an Iterator over all the Exceptions in the database.

Specified by:
getExceptionIterator in class Dictionary
Parameters:
pos - the part-of-speech
Returns:
Iterator An iterator over Excs
Throws:
JWNLException - JWNLException

getSynsetIterator

public Iterator<Synset> getSynsetIterator(POS pos)
                                   throws JWNLException
Description copied from class: Dictionary
Returns an Iterator over all the Synsets of part-of-speech pos in the database.

Specified by:
getSynsetIterator in class Dictionary
Parameters:
pos - The part-of-speech.
Returns:
An iterator over Synsets.
Throws:
JWNLException - JWNLException

getIndexWordIterator

public Iterator<IndexWord> getIndexWordIterator(POS pos)
                                         throws JWNLException
Description copied from class: Dictionary
Returns an Iterator over all the IndexWords of part-of-speech pos in the database.

Specified by:
getIndexWordIterator in class Dictionary
Parameters:
pos - The part-of-speech
Returns:
iterator over IndexWords
Throws:
JWNLException - JWNLException

getIndexWordIterator

public Iterator<IndexWord> getIndexWordIterator(POS pos,
                                                String substring)
                                         throws JWNLException
Description copied from class: Dictionary
Returns an Iterator over all the IndexWords of part-of-speech pos whose lemmas contain substring as a substring.

Specified by:
getIndexWordIterator in class Dictionary
Parameters:
pos - The part-of-speech.
substring - substring
Returns:
An iterator over IndexWords.
Throws:
JWNLException - JWNLException

edit

public void edit()
          throws JWNLException
Description copied from class: Dictionary
Puts the dictionary into edit mode.

Overrides:
edit in class Dictionary
Throws:
JWNLException - JWNLException

addSynset

public void addSynset(Synset synset)
               throws JWNLException
Description copied from class: Dictionary
Adds synset to the dictionary.

Overrides:
addSynset in class Dictionary
Parameters:
synset - synset to add
Throws:
JWNLException - JWNLException

removeSynset

public void removeSynset(Synset synset)
                  throws JWNLException
Description copied from class: Dictionary
Removes synset from the dictionary.

Overrides:
removeSynset in class Dictionary
Parameters:
synset - synset to remove
Throws:
JWNLException - JWNLException

addException

public void addException(Exc exc)
                  throws JWNLException
Description copied from class: Dictionary
Adds exception to the dictionary.

Overrides:
addException in class Dictionary
Parameters:
exc - exception to add
Throws:
JWNLException - JWNLException

removeException

public void removeException(Exc exc)
                     throws JWNLException
Description copied from class: Dictionary
Removes the exc from the dictionary.

Overrides:
removeException in class Dictionary
Parameters:
exc - exc to be removed
Throws:
JWNLException - JWNLException

addIndexWord

public void addIndexWord(IndexWord indexWord)
                  throws JWNLException
Description copied from class: Dictionary
Adds index word to the dictionary.

Overrides:
addIndexWord in class Dictionary
Parameters:
indexWord - index word to add
Throws:
JWNLException - JWNLException

removeIndexWord

public void removeIndexWord(IndexWord indexWord)
                     throws JWNLException
Description copied from class: Dictionary
Removes indexWord from the dictionary.

Overrides:
removeIndexWord in class Dictionary
Parameters:
indexWord - index word to remove
Throws:
JWNLException - JWNLException

cacheAll

public void cacheAll()
              throws JWNLException
Throws:
JWNLException

cachePOS

protected void cachePOS(POS pos)
                 throws JWNLException
Throws:
JWNLException


Copyright © 2013. All Rights Reserved.