Class Page

java.lang.Object
  extended by Page

public class Page
extends java.lang.Object

This class represents one Page of a game book. It has a page number, a description of the story and up to three Choices for the user.

Author:
Tim

Constructor Summary
Page(int pageNumber, java.lang.String text)
          This constructor is for making pages that have only no Choices.
Page(int pageNumber, java.lang.String text, Choice option1)
          This constructor is for making pages that have only one Choices
Page(int pageNumber, java.lang.String text, Choice option1, Choice option2)
          This constructor is for making pages that have two Choices
Page(int pageNumber, java.lang.String text, Choice option1, Choice option2, Choice option3)
          This constructor is for making pages that have three Choices
 
Method Summary
 Choice getChoice(int i)
          Get the Choice that has the number i.
 int getPageNumber()
          Get the page number
 java.lang.String getText()
          Get the part of the story that's on this Page
 boolean isEndOfStory()
          Returns true if there if this is an ending to the story.
 void printText()
          Causes the Page to print itself to System.out.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Page

public Page(int pageNumber,
            java.lang.String text,
            Choice option1,
            Choice option2,
            Choice option3)
This constructor is for making pages that have three Choices

Parameters:
pageNumber - the page number
text - the part of the story that's on this page
option1 - the first Choice
option2 - the second choice
option3 - the third choice

Page

public Page(int pageNumber,
            java.lang.String text,
            Choice option1,
            Choice option2)
This constructor is for making pages that have two Choices

Parameters:
pageNumber - the page number
text - the part of the story that's on this page
option1 - the first Choice
option2 - the second choice

Page

public Page(int pageNumber,
            java.lang.String text,
            Choice option1)
This constructor is for making pages that have only one Choices

Parameters:
pageNumber - the page number
text - the part of the story that's on this page
option1 - the only Choice

Page

public Page(int pageNumber,
            java.lang.String text)
This constructor is for making pages that have only no Choices. The game ends (either in a win or a loss) when one of these pages is met.

Parameters:
pageNumber - the page number
text - the part of the story that's on this page
Method Detail

getPageNumber

public int getPageNumber()
Get the page number

Returns:
the page number

getText

public java.lang.String getText()
Get the part of the story that's on this Page

Returns:
the story on this Page

printText

public void printText()
Causes the Page to print itself to System.out. Should include the text of the story and a list of all possible choices number 1, 2, ...


isEndOfStory

public boolean isEndOfStory()
Returns true if there if this is an ending to the story. That is, it returns true if there are no possible choices

Returns:
true if there are no possible choices

getChoice

public Choice getChoice(int i)
Get the Choice that has the number i. It returns null if there is no such choice.

Parameters:
i - the number if the Choice we want to get.
Returns:
the Choice at position i