speech
Class Dialog

java.lang.Object
  extended by speech.Dialog
All Implemented Interfaces:
java.io.Serializable

public class Dialog
extends java.lang.Object
implements java.io.Serializable

This class represents a dialog between the player and another character. It uses options for questions the player can ask

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
Dialog(Player player, java.lang.String name)
           
 
Method Summary
 void addDialogBranch(int id, java.lang.String question, Talk talkAction)
          Adds a dialog branch to the dialog.
 DialogBranch getBranch(int id)
          Returns the dialog branch with the specified id, if it exists, else this method returns null
 java.util.LinkedList<DialogBranch> getBranches()
          Returns a list of dialog branches of this dialog
 java.lang.String getName()
          Returns the name of the dialog.
 void runDialogBranch(int id)
          Starts the dialog branch which is specified by the id
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dialog

public Dialog(Player player,
              java.lang.String name)
Method Detail

getName

public java.lang.String getName()
Returns the name of the dialog. The name is the identifier of the dialog

Returns:
identifying name of the dialog

addDialogBranch

public void addDialogBranch(int id,
                            java.lang.String question,
                            Talk talkAction)
Adds a dialog branch to the dialog. If a branch with the same id already exits the dialog branch won't be added

Parameters:
id - id for the dialog branch
question - question that is associated to the dialog branch
talkAction - talk action to fire when choosing the dialog branch

runDialogBranch

public void runDialogBranch(int id)
Starts the dialog branch which is specified by the id

Parameters:
id - id of the dialog branch to be run

getBranch

public DialogBranch getBranch(int id)
Returns the dialog branch with the specified id, if it exists, else this method returns null

Parameters:
id - id of the dialog branch to be found
Returns:
dialog branch with the specified id

getBranches

public java.util.LinkedList<DialogBranch> getBranches()
Returns a list of dialog branches of this dialog

Returns:
dialog branches of this dialog