textmaven.dictionaries
Class CompositeDictionary

java.lang.Object
  extended bytextmaven.dictionaries.BaseDictionary
      extended bytextmaven.dictionaries.Dictionary
          extended bytextmaven.dictionaries.CompositeDictionary
All Implemented Interfaces:
IBaseDictionary, IDictionary, IDictionarySource
Direct Known Subclasses:
DictionarySequence, DictionaryUnion

public abstract class CompositeDictionary
extends Dictionary
implements IDictionary

Dictionary composed of one or more dictionaries. Subclasses have to decide what search strategy the use.

Author:
krebtho

Constructor Summary
CompositeDictionary()
           
 
Method Summary
 void add(IDictionary dictionary)
          Adds the specified dictionary.
 void add(java.util.List l)
          Adds the specified list of dictionaries.
 java.lang.Object clone()
          Performs a shallow copy of the instance.
 void close()
          Performs close operations on the source.
abstract  boolean containsKey(java.lang.String key)
          Checks whether a key is contained in the dictionary.
static IDictionary createDictionary(java.lang.String str)
          Creates a composite dictionary as specified in the input string.
 java.util.List getDictionaries()
          Returns list of dictionaries composing this instance.
abstract  java.util.Iterator keys()
          Returns all keys as specified in dictionary.
 void open()
          Opens connection to datasource
 void remove(IDictionary dictionary)
          Removes the specified dictionary.
 void removeAll()
          Removes all dictionaries from this instance.
 java.util.Iterator translations()
          Returns all translations in all dictionaries aggregated by this instance, no matter what access strategy is implemented by the specific instance.
abstract  java.util.Iterator translations(java.lang.String word)
          Retrieves available translations for a given word.
 
Methods inherited from class textmaven.dictionaries.Dictionary
getStemmer, keys, setStemmer
 
Methods inherited from class textmaven.dictionaries.BaseDictionary
getDescription, getId, getLanguage, setDescription, setId, setLanguage, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface textmaven.dictionaries.IDictionary
keys, keysWithPrefix
 
Methods inherited from interface textmaven.dictionaries.IBaseDictionary
getDescription, getId, getLanguage, setDescription, setId, setLanguage
 

Constructor Detail

CompositeDictionary

public CompositeDictionary()
Method Detail

add

public void add(IDictionary dictionary)
Adds the specified dictionary. The added dictionary will be included in the search strategy implemented by the specific instance.

Parameters:
dictionary - dictionary to be added

add

public void add(java.util.List l)
Adds the specified list of dictionaries. The added dictionaries are included in the search strategy implemented by the specific instance.

Parameters:
l - List of dictionary instances IDictionary

remove

public void remove(IDictionary dictionary)
Removes the specified dictionary.

Parameters:
dictionary - dictionary to be removed

removeAll

public void removeAll()
Removes all dictionaries from this instance.


getDictionaries

public java.util.List getDictionaries()
Returns list of dictionaries composing this instance.

Returns:
List of IDictionary instances IDictionary

translations

public abstract java.util.Iterator translations(java.lang.String word)
Description copied from interface: IDictionary
Retrieves available translations for a given word.

The word is retrieved from the dictionary as passed in as parameter. If no translation is found, an empty iterator.

Specified by:
translations in interface IDictionary
Specified by:
translations in class Dictionary

containsKey

public abstract boolean containsKey(java.lang.String key)
Description copied from interface: IDictionary
Checks whether a key is contained in the dictionary.

Specified by:
containsKey in interface IDictionary
Specified by:
containsKey in class Dictionary

keys

public abstract java.util.Iterator keys()
Description copied from interface: IDictionary
Returns all keys as specified in dictionary.

Specified by:
keys in interface IDictionary
Specified by:
keys in class Dictionary

open

public void open()
Description copied from interface: IBaseDictionary
Opens connection to datasource

Specified by:
open in interface IBaseDictionary
Specified by:
open in class Dictionary

close

public void close()
Description copied from interface: IBaseDictionary
Performs close operations on the source. The source cannot be used after closing it.

Specified by:
close in interface IBaseDictionary
Specified by:
close in class Dictionary

translations

public java.util.Iterator translations()
Returns all translations in all dictionaries aggregated by this instance, no matter what access strategy is implemented by the specific instance.

Specified by:
translations in interface IDictionary
Returns:
Iterator returning translations Translation

clone

public java.lang.Object clone()
Performs a shallow copy of the instance.


createDictionary

public static final IDictionary createDictionary(java.lang.String str)
                                          throws ParseException
Creates a composite dictionary as specified in the input string. The input string has to be in the format [id=id1,id2,..] or id. In the former case a composite dictionary is created from the prototype dictionary specified by id. The dictionary consists of the dictionaries id1,id2,.... In the latter case only the dictionary specified by id is returned.

Parameters:
str - dictionary specification as defined.
Returns:
IDictionary
Throws:
ParseException


Copyright © 2002-2005 Sourceforge. All Rights Reserved.