java.lang.Object
model.logic.server.dictionary.DictionaryManager
-
Method Summary
Modifier and TypeMethodDescriptionbooleanThe challenge function takes in a String array of words and returns true if any of the words are anagrams of the last word.static DictionaryManagerget()The get function is a static function that returns the singleton instance of the DictionaryManager class.intgetSize()The getSize function returns the size of the map.booleanThe query function takes in a String array of arguments and returns a boolean.
-
Method Details
-
get
The get function is a static function that returns the singleton instance of the DictionaryManager class. If no instance exists, it creates one and then returns it.- Returns:
- The singleton instance of the dictionary manager
-
query
The query function takes in a String array of arguments and returns a boolean. The last argument is the word to be searched for, while the rest are dictionaries that will be searched through. If any of the dictionaries contain the word, then true is returned; otherwise false is returned. This function also adds new entries to map if they do not already exist there (i.e., if an entry does not exist in map, it will create one).- Parameters:
args- args Pass in a variable number of arguments- Returns:
- True if the word is found in any of the dictionaries,
-
challenge
The challenge function takes in a String array of words and returns true if any of the words are anagrams of the last word. It does this by iterating through each word in the array, excluding the last one, and checking to see if it is an anagram using its challenge function.- Parameters:
args- args Pass in a variable number of arguments- Returns:
- True if any of the words in args are a valid
-
getSize
public int getSize()The getSize function returns the size of the map.- Returns:
- The size of the map
-