Class Dictionary

java.lang.Object
Model.gameClasses.Dictionary

public class Dictionary extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Dictionary(String... fileNames)
    The Dictionary constructor gets string(s) of file(s) name(s) and create a LRU cache for placing the exist words and LFU for the notExists
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
    query(String word)
    check if the word has been asked recently, if not - searching it line by line (and add to the relevant cache)

    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 constructor gets string(s) of file(s) name(s) and create a LRU cache for placing the exist words and LFU for the notExists
      Parameters:
      fileNames - array of given name(s) of file(s)
  • Method Details

    • query

      public boolean query(String word)
      check if the word has been asked recently, if not - searching it line by line (and add to the relevant cache)
      Parameters:
      word - the word we want to ask for.
      Returns:
      true if the word is valid, false if invalid
    • challenge

      public boolean challenge(String word)
      Parameters:
      word - to check with IO searching
      Returns:
      if the word is in the "BOOKS" by searching it line by line - and add the word to the relevant cache.