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

public abstract class AbstractDictionary extends Object implements Dictionary
An abstract implementation of the Dictionary interface.
Version:
Alpha v.0.4
Author:
Logan Ferree (Tadukoo)
  • Field Details

  • Constructor Details

    • AbstractDictionary

      protected AbstractDictionary()
      Constructs a new Dictionary that's empty
    • AbstractDictionary

      protected AbstractDictionary(Map<Character,Map<Character,?>> map)
      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

      public Map<Character,Map<Character,?>> asMap()
      Specified by:
      asMap in interface Dictionary
      Returns:
      The valid words for this Dictionary in a Map
    • isValidWord

      public boolean isValidWord(CharSequence word)
      Specified by:
      isValidWord in interface Dictionary
      Parameters:
      word - The word to look for in this Dictionary
      Returns:
      If the given word is in this Dictionary or not
    • addWord

      public boolean addWord(CharSequence word)
      Adds the given word to this Dictionary
      Specified by:
      addWord in interface Dictionary
      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

      public boolean removeWord(CharSequence word)
      Removes the given word from this Dictionary
      Specified by:
      removeWord in interface Dictionary
      Parameters:
      word - The word to be removed from this Dictionary
      Returns:
      true if the word was removed, or false if it wasn't found