Class WordGenerator
- java.lang.Object
-
- org.apache.wicket.examples.hangman.WordGenerator
-
- All Implemented Interfaces:
Serializable,IClusterable
public class WordGenerator extends Object implements IClusterable
The word generator is responsible for reading in a list of words from a data file and serving them up in a random order. The generator keeps a state record of which words it has served and randomises them again when the last word has been served.- Version:
- 1.0
- Author:
- Chris Turner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WordGenerator()Create the word generator, loading the words and preparing them for serving.WordGenerator(String[] words)Create the word generator using the supplied array of words as the word source to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Wordnext()Returns the next word from the word generator.intsize()Get the number of words that were discovered.
-
-
-
Constructor Detail
-
WordGenerator
public WordGenerator()
Create the word generator, loading the words and preparing them for serving.
-
WordGenerator
public WordGenerator(String[] words)
Create the word generator using the supplied array of words as the word source to use.- Parameters:
words- The words to use
-
-
Method Detail
-
next
public Word next()
Returns the next word from the word generator.- Returns:
- The next word
-
size
public int size()
Get the number of words that were discovered.- Returns:
- The number of words
-
-