public class QueryResults
extends java.lang.Object
Constructor | Description |
---|---|
QueryResults(java.lang.String filename) |
Constructor for the QueryResults class.
|
Modifier and Type | Method | Description |
---|---|---|
int |
getCount() |
Get number of recursive calls.
|
java.util.List<java.lang.String> |
getDictionary() |
Getter method for the dictionary object.
|
java.util.List<java.lang.String> |
getList() |
Getter method for the list object.
|
java.lang.String |
getWord() |
Getter method for the current string being queried.
|
static void |
main(java.lang.String[] args) |
|
java.util.List<java.lang.String> |
readDictionary(java.lang.String filename) |
Create a new
List and then read each token from
the file called filename and add it into the
List . |
void |
searchDictionary(java.lang.String word) |
Recursively search substrings of the parameter
word
and store uniquely in the List list . |
java.util.List<java.lang.String> |
searchDictionaryHelper(java.util.List<java.lang.String> wordList,
java.lang.String word) |
Helper method for
searchDictionary . |
java.lang.String |
toString() |
toString for you QueryResults class.
|
public QueryResults(java.lang.String filename) throws java.io.FileNotFoundException
filename
- name of the dictionary filejava.io.FileNotFoundException
- exception is thrown to the calling method if unable to open filepublic java.util.List<java.lang.String> getDictionary()
List
dictionary objectpublic java.util.List<java.lang.String> getList()
List
of words found in searchDictionary(java.lang.String)
method.public int getCount()
searchDictionary
.public java.lang.String getWord()
public java.util.List<java.lang.String> readDictionary(java.lang.String filename) throws java.io.FileNotFoundException
List
and then read each token from
the file called filename
and add it into the
List
.filename
- name of filejava.io.FileNotFoundException
- exception is thrown to the calling method if unable to open file.Scanner.hasNext()
,
Scanner.next()
public void searchDictionary(java.lang.String word)
word
and store uniquely in the List
list
.
word
into the corresponding member variable
list
to the return value for searchDictionaryHelper(List, String)
method.
Pass in a new ArrayList and the word as parameters.
word
- the word to query.public java.util.List<java.lang.String> searchDictionaryHelper(java.util.List<java.lang.String> wordList, java.lang.String word)
searchDictionary
. wordList
.
ArrayList.contains(Object)
.wordList
- A List of unique legal substrings from the parameter, wordword
- The word being queriedArrayList.contains(Object)
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args) throws java.io.FileNotFoundException
java.io.FileNotFoundException