Class AbstractDictionary
java.lang.Object
com.github.tadukoo.util.dictionary.AbstractDictionary
- All Implemented Interfaces:
Dictionary
- Direct Known Subclasses:
ISO_LATIN1Dictionary,US_ASCIIDictionary,UTF16BEDictionary,UTF16Dictionary,UTF16LEDictionary,UTF8Dictionary
An abstract implementation of the
Dictionary interface.- Version:
- Alpha v.0.4
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a new Dictionary that's emptyprotectedAbstractDictionary(Map<Character, Map<Character, ?>> map) Constructs a new Dictionary that contains the words in the given Map -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddWord(CharSequence word) Adds the given word to this DictionaryasMap()booleanisValidWord(CharSequence word) booleanremoveWord(CharSequence word) Removes the given word from this DictionaryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.tadukoo.util.dictionary.Dictionary
supportedCharset
-
Field Details
-
map
The Map containing the valid words for this Dictionary
-
-
Constructor Details
-
AbstractDictionary
protected AbstractDictionary()Constructs a new Dictionary that's empty -
AbstractDictionary
Constructs a new Dictionary that contains the words in the given Map- Parameters:
map- The Map containing valid words for this Dictionary
-
-
Method Details
-
asMap
- Specified by:
asMapin interfaceDictionary- Returns:
- The valid words for this Dictionary in a Map
-
isValidWord
- Specified by:
isValidWordin interfaceDictionary- Parameters:
word- The word to look for in this Dictionary- Returns:
- If the given word is in this Dictionary or not
-
addWord
Adds the given word to this Dictionary- Specified by:
addWordin interfaceDictionary- Parameters:
word- The word to be added to this Dictionary- Returns:
- If the word was added to the Dictionary (or already exists in it)
-
removeWord
Removes the given word from this Dictionary- Specified by:
removeWordin interfaceDictionary- Parameters:
word- The word to be removed from this Dictionary- Returns:
- true if the word was removed, or false if it wasn't found
-