-
Notifications
You must be signed in to change notification settings - Fork 0
/
WordList.java
69 lines (60 loc) · 1.5 KB
/
WordList.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.util.ArrayList;
/**
* This manages the wordList Array List for the Word Search game. The Array List
* is used to track how many words the user still has to find.
*
* The following files are also required to run:
*
* WordSearch.java Base.java WordSelect.java
*
* @version 2.0
* @author Seth Hilder (478393)
* @version 14 May 2018
*/
public class WordList {
private ArrayList<String> wordList = new ArrayList<String>(); // Stores the list of words to find
/**
* Adds a word to wordList
*
* @param word The word to add
*/
public void addWord(String word) {
wordList.add(word);
}
/**
* Returns the size of wordList
*/
public int getSize() {
return wordList.size();
}
/**
* Returns the value of wordList at a given position.
*
* @param pos The index of the value to return
*/
public String getValue(int pos) {
return wordList.get(pos);
}
/**
* Removes all values in wordList.
*/
public void clearArrayList() {
wordList.clear();
}
/**
* Returns true if wordList contains a given word
*
* @param word Word to check if wordList contains
*/
public boolean checkContains(String word) {
return wordList.contains(word);
}
/**
* Removes a given position from wordList
*
* @param pos Position of word to remove
*/
public void removeWordListValue(int pos) {
wordList.remove(pos);
}
}