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
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructs a new Dictionary that's emptyprotected
AbstractDictionary
(Map<Character, Map<Character, ?>> map) Constructs a new Dictionary that contains the words in the given Map -
Method Summary
Modifier and TypeMethodDescriptionboolean
addWord
(CharSequence word) Adds the given word to this DictionaryasMap()
boolean
isValidWord
(CharSequence word) boolean
removeWord
(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, wait
Methods 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:
asMap
in interfaceDictionary
- Returns:
- The valid words for this Dictionary in a Map
-
isValidWord
- Specified by:
isValidWord
in 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:
addWord
in 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:
removeWord
in 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
-