Class Dictionary

java.lang.Object
model.logic.server.dictionary.Dictionary

public class Dictionary extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Dictionary(String... fileNames)
    The Dictionary function takes in a list of file names and adds the words from each file to the bloom filter.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    The challenge function takes in a word and checks if it is in the dictionary.
    boolean
    query(String word)
    The query function takes in a string and returns true if the word is in the dictionary, false otherwise.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Dictionary

      public Dictionary(String... fileNames)
      The Dictionary function takes in a list of file names and adds the words from each file to the bloom filter.
      Parameters:
      fileNames - fileNames Allow the user to pass in an arbitrary number of file names
  • Method Details

    • query

      public boolean query(String word)
      The query function takes in a string and returns true if the word is in the dictionary, false otherwise.
      Parameters:
      word - word Query the bloom filter
      Returns:
      True if the word is in the data structure
    • challenge

      public boolean challenge(String word)
      The challenge function takes in a word and checks if it is in the dictionary. If it is, then the word will be added to LRU cache. Otherwise, it will be added to LFU cache.
      Parameters:
      word - word Search for the word in the files
      Returns:
      True if the word is found in any of the files, and false otherwise