Class NetLibs.StoryTemplate
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class NetLibs.StoryTemplate

java.lang.Object
   |
   +----NetLibs.StoryTemplate

public class StoryTemplate
extends Object
implements NetLibsConst
StoryTemplate implements the class which handles reading the story template text, getting the prompts, reading the dictionaries, and choosing random words.

Author:
Michael Benson

Constructor Index

 o StoryTemplate()
StoryTemplate constructor.

Method Index

 o getPrompts(Applet, String)
Reads in a prompt file and separates the prompts.
 o getRandomWord(Applet, String)
Gets a random word of type prompt.
 o getTemplate(Applet, String)
Reads in a story template.

Constructors

 o StoryTemplate
  public StoryTemplate()
StoryTemplate constructor.

Methods

 o getTemplate
  public String getTemplate(Applet applet,
                            String storyName) throws IOException
Reads in a story template.
Parameters:
applet - the parent applet (used for code base).
storyName - the name of the story template.
Returns:
string containing the story template.
Throws: IOException
if error reading template file.
 o getPrompts
  public Vector getPrompts(Applet applet,
                           String storyName) throws IOException, MalformedURLException
Reads in a prompt file and separates the prompts. Creates a vector in which each element is a prompt string.
Parameters:
applet - the parent applet (used for code base).
storyName - the name of the story template.
Returns:
vector containing each prompt string.
Throws: IOException
if error reading prompt file.
Throws: MalformedURLException
if error finding prompt file.
 o getRandomWord
  public String getRandomWord(Applet applet,
                              String prompt) throws IOException, MalformedURLException
Gets a random word of type prompt. If number prompt is found, it will generate a random number. Also, if the prompt is capitalized, the chosen word will be capitalized.
Parameters:
applet - the parent applet (used for code base).
Returns:
the word chosen at random.
Throws: IOException
if error reading prompt file.
Throws: MalformedURLException
if error finding prompt file.

All Packages  Class Hierarchy  This Package  Previous  Next  Index