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
-
StoryTemplate()
- StoryTemplate constructor.
-
getPrompts(Applet, String)
- Reads in a prompt file and separates the prompts.
-
getRandomWord(Applet, String)
- Gets a random word of type prompt.
-
getTemplate(Applet, String)
- Reads in a story template.
StoryTemplate
public StoryTemplate()
- StoryTemplate constructor.
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.
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.
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