org.apache.wicket.examples.hangman
Class WordGenerator

java.lang.Object
  extended by 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
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
 Word next()
          Returns the next word from the word generator.
 int size()
          Get the number of words that were discovered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.