Interface Dictionary


public interface Dictionary
Provides functionality for working with a spell check dictionary.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(String word)
    Adds the given word to the dictionary and schedules a write to disk.
    boolean
    has(String word)
    Returns true if the dictionary contains the given word.
    boolean
    remove(String word)
    Removes the given word from the dictionary and schedules a write to disk.
    Returns the words in the current dictionary or an empty collection if the dictionary does not have any word.
  • Method Details

    • words

      Collection<String> words()
      Returns the words in the current dictionary or an empty collection if the dictionary does not have any word.
      Throws:
      ObjectClosedException - when the engine is closed
    • add

      boolean add(String word)
      Adds the given word to the dictionary and schedules a write to disk.
      Parameters:
      word - a word to add to the dictionary. It must be UTF8, between 1 and 99 bytes long, and without leading or trailing ASCII whitespace
      Returns:
      true if the given word is valid and not a duplicate
      Throws:
      IllegalArgumentException - when word is empty or blank
      ObjectClosedException - when the engine is closed
    • remove

      boolean remove(String word)
      Removes the given word from the dictionary and schedules a write to disk.
      Parameters:
      word - a word to remove from the dictionary. It must be UTF8, between 1 and 99 bytes long, and without leading or trailing ASCII whitespace
      Returns:
      true if the given word was found and removed successfully
      Throws:
      IllegalArgumentException - when word is empty or blank
      ObjectClosedException - when the engine is closed
    • has

      boolean has(String word)
      Returns true if the dictionary contains the given word.
      Parameters:
      word - a word to check. It must be UTF8, between 1 and 99 bytes long, and without leading or trailing ASCII whitespace
      Throws:
      IllegalArgumentException - when word is empty or blank
      ObjectClosedException - when the engine is closed