net.sourceforge.worldsaver.rp
Class Campaign

java.lang.Object
  |
  +--net.sourceforge.worldsaver.rp.RpBase
        |
        +--net.sourceforge.worldsaver.rp.Action
              |
              +--net.sourceforge.worldsaver.rp.Campaign
All Implemented Interfaces:
MiscUtils, Saveable

public class Campaign
extends Action
implements MiscUtils, Saveable

This class represents a campaign, normally a sorted list (more or less) of adventures.

Version:
Feb 16 2001
Author:
Andreas Schmitz

Fields inherited from interface net.sourceforge.worldsaver.util.MiscUtils
CONSOLE_WIDTH, NEWLINE, RANDOM
 
Constructor Summary
Campaign(java.util.HashMap loaded)
          The standard constructor.
Campaign(RpBase father, java.lang.String name)
          The standard constructor.
 
Method Summary
 RpBase copy(boolean childs, boolean full)
          Returns a new object with the same values as this object.
 void createActionTree(ActionParticle p)
          Sets the ActionTree that shall be used for the action.
 void execute()
          Prepares the action for execution.
 void getReferencesRight(java.util.HashMap pool, IDGenerator gen)
          Must set the references right by getting the real objects out of the pool.
 java.lang.String getSaveableString()
          Must return a ready-to-save String.
 boolean isRunnable()
          Returns whether the action is prepared to be executed.
 void step(int index)
          Causes the action to do a step in a specific direction.
 
Methods inherited from class net.sourceforge.worldsaver.rp.Action
getActionTree, getDecisionMessage, getLocation, getStartLocation, getText, isRunning, setStartLocation
 
Methods inherited from class net.sourceforge.worldsaver.rp.RpBase
addChild, addDescription, getChilds, getDescription, getFather, getID, getName, setDescription, setFather, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Campaign

public Campaign(RpBase father,
                java.lang.String name)
The standard constructor.
See Also:
RpBase.RpBase(net.sourceforge.worldsaver.rp.RpBase, java.lang.String), Action.Action(net.sourceforge.worldsaver.rp.RpBase, java.lang.String)

Campaign

public Campaign(java.util.HashMap loaded)
The standard constructor.
See Also:
RpBase.RpBase(net.sourceforge.worldsaver.rp.RpBase, java.lang.String), Action.Action(net.sourceforge.worldsaver.rp.RpBase, java.lang.String)
Method Detail

getReferencesRight

public void getReferencesRight(java.util.HashMap pool,
                               IDGenerator gen)
Description copied from interface: Saveable
Must set the references right by getting the real objects out of the pool. The Pool contains keys as unique Long values.
Specified by:
getReferencesRight in interface Saveable
Overrides:
getReferencesRight in class Action
Following copied from interface: net.sourceforge.worldsaver.rp.Saveable
Parameters:
pool - the objects that could be referenced
gen - the ID-Generator for this object

getSaveableString

public java.lang.String getSaveableString()
                                   throws java.io.IOException
Description copied from interface: Saveable
Must return a ready-to-save String.
Specified by:
getSaveableString in interface Saveable
Overrides:
getSaveableString in class Action
Following copied from interface: net.sourceforge.worldsaver.rp.Saveable
Returns:
the String
Throws:
java.io.IOException - if the objects are not valid

copy

public RpBase copy(boolean childs,
                   boolean full)
Description copied from class: RpBase
Returns a new object with the same values as this object. This method copies the fields of the object and all childs, but not the father. Also, every object is created new and a new IDGenerator is created (there are also made new IDs for every object). Note that only every non-abstract subclass should write this method. Like the getDescription method, you can choose whether and how the childs are treated.
Overrides:
copy in class RpBase
Following copied from class: net.sourceforge.worldsaver.rp.RpBase
Parameters:
childs - true means copy the childs, too
full - true means copy the childs of the childs etc., too
Returns:
the new object (the father of all childs)

execute

public void execute()
Description copied from class: Action
Prepares the action for execution. The first situation (the first step) is executed in this method.
Overrides:
execute in class Action

step

public void step(int index)
Description copied from class: Action
Causes the action to do a step in a specific direction. The index is the index of the step the party has chosen.
Overrides:
step in class Action
Following copied from class: net.sourceforge.worldsaver.rp.Action
Parameters:
index - the index

isRunnable

public boolean isRunnable()
Description copied from class: Action
Returns whether the action is prepared to be executed.
Overrides:
isRunnable in class Action
Following copied from class: net.sourceforge.worldsaver.rp.Action
Returns:
true when ready to be executed

createActionTree

public void createActionTree(ActionParticle p)
Description copied from class: Action
Sets the ActionTree that shall be used for the action. The action tree should be ready before you insert it here. Depending of its correctness, the action becomes runnable or not.
Overrides:
createActionTree in class Action
Following copied from class: net.sourceforge.worldsaver.rp.Action
Parameters:
top - the ActionParticle that builds the top of the tree