X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=kona%2Fsrc%2Forg%2Ffeistymeow%2Ftextual%2FSimpleDictionary.java;h=9008ac97246456d40fe852aa4b9e4b76cdca4d04;hb=1f6e7f7c3be3f2198df8211bf14b15856d9853a8;hp=6d71f9b83c16e202b6b5486e562f43f51e4495c9;hpb=31731a0098657ef95424d46f8f973d50904ca8a0;p=feisty_meow.git diff --git a/kona/src/org/feistymeow/textual/SimpleDictionary.java b/kona/src/org/feistymeow/textual/SimpleDictionary.java index 6d71f9b8..9008ac97 100644 --- a/kona/src/org/feistymeow/textual/SimpleDictionary.java +++ b/kona/src/org/feistymeow/textual/SimpleDictionary.java @@ -4,39 +4,46 @@ import java.util.HashSet; import java.util.Set; public class SimpleDictionary extends HashSet -//or alternatively, BinaryTree -//=> what is BST implem for java! is it balanced? +// or alternatively, BinaryTree +// => what is BST implem for java! is it balanced? { - public SimpleDictionary (Set words) { - addAll(words); - computeLongestWord(); - } - - public SimpleDictionary (String words[]) { - for (String word : words) { - add(word); + + private static final long serialVersionUID = 1L; + + public SimpleDictionary(Set words) + { + addAll(words); + computeLongestWord(); } - computeLongestWord(); - } - - public int computeLongestWord() { - previouslyComputedLongestWord = 1; - - //hmmm: iterate on set to find longest. - -//kludge implem placeholder. -previouslyComputedLongestWord = 100; - return previouslyComputedLongestWord; - } - - public boolean lookup(String toFind) { - return contains(toFind); - } - - public int longestWord() { - return previouslyComputedLongestWord; - } - - int previouslyComputedLongestWord; -} + public SimpleDictionary(String words[]) + { + for (String word : words) { + add(word); + } + computeLongestWord(); + } + + public int computeLongestWord() + { + previouslyComputedLongestWord = 1; + + // hmmm: iterate on set to find longest. + + // kludge implem placeholder. + previouslyComputedLongestWord = 100; + return previouslyComputedLongestWord; + } + + public boolean lookup(String toFind) + { + return contains(toFind); + } + + public int longestWord() + { + return previouslyComputedLongestWord; + } + + int previouslyComputedLongestWord; +}