feisty meow concerns codebase
2.140
SimpleDictionary.java
Go to the documentation of this file.
1
package
org.feistymeow.textual;
2
3
import
java.util.HashSet;
4
import
java.util.Set;
5
6
public
class
SimpleDictionary
extends
HashSet<String>
7
// or alternatively, BinaryTree<String>
8
// => what is BST implem for java! is it balanced?
9
{
10
11
private
static
final
long
serialVersionUID = 1L;
12
13
public
SimpleDictionary
(Set<String> words)
14
{
15
addAll(words);
16
computeLongestWord
();
17
}
18
19
public
SimpleDictionary
(String words[])
20
{
21
for
(String word : words) {
22
add(word);
23
}
24
computeLongestWord
();
25
}
26
27
public
int
computeLongestWord
()
28
{
29
previouslyComputedLongestWord = 1;
30
31
// hmmm: iterate on set to find longest.
32
33
// kludge implem placeholder.
34
previouslyComputedLongestWord = 100;
35
return
previouslyComputedLongestWord;
36
}
37
38
public
boolean
lookup
(String toFind)
39
{
40
return
contains(toFind);
41
}
42
43
public
int
longestWord
()
44
{
45
return
previouslyComputedLongestWord;
46
}
47
48
int
previouslyComputedLongestWord;
49
}
org.feistymeow.textual.SimpleDictionary
Definition:
SimpleDictionary.java:9
org.feistymeow.textual.SimpleDictionary.lookup
boolean lookup(String toFind)
Definition:
SimpleDictionary.java:38
org.feistymeow.textual.SimpleDictionary.longestWord
int longestWord()
Definition:
SimpleDictionary.java:43
org.feistymeow.textual.SimpleDictionary.SimpleDictionary
SimpleDictionary(Set< String > words)
Definition:
SimpleDictionary.java:13
org.feistymeow.textual.SimpleDictionary.computeLongestWord
int computeLongestWord()
Definition:
SimpleDictionary.java:27
org.feistymeow.textual.SimpleDictionary.SimpleDictionary
SimpleDictionary(String words[])
Definition:
SimpleDictionary.java:19
kona
src
org
feistymeow
textual
SimpleDictionary.java
Generated by
1.9.1