net.sourceforge.worldsaver.rp
Class ActionParticle

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

public class ActionParticle
extends java.lang.Object
implements MiscUtils, Saveable

The ActionTree needed by Action classes consists of several of these ActionParticles.

Version:
Feb 11 2001
Author:
Andreas Schmitz

Fields inherited from interface net.sourceforge.worldsaver.util.MiscUtils
CONSOLE_WIDTH, NEWLINE, RANDOM
 
Constructor Summary
ActionParticle(java.util.HashMap loaded)
          Reconstructs an AP from a loaded String.
ActionParticle(java.lang.String msg, java.lang.String txt, IDGenerator gen)
          Creates a new ActionParticle with the given decision message and the given text.
 
Method Summary
 void addSubParticle(ActionParticle val)
          Adds another particle to this action tree (at this level).
 java.lang.String getDecisionMessage()
          Returns the decision message.
 java.lang.String[] getDecisionMessages()
          Returns the decision messages of all following ActionParticles.
 long getID()
          Returns the object ID.
 void getReferencesRight(java.util.HashMap pool, IDGenerator gen)
          Gets the references right after loading.
 java.lang.String getSaveableString()
          Returns the saveable String.
protected  java.util.HashSet getSubParticles()
          Returns the sub-particles of this particle.
 java.lang.String getText()
          Returns the text describing the situation.
 boolean isEndOfTree()
          Returns whether there is a deeper level of the action tree or not.
 void setDecisionMessage(java.lang.String val)
          Sets the decision message.
 void setText(java.lang.String val)
          Sets the text explaining the situation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionParticle

public ActionParticle(java.lang.String msg,
                      java.lang.String txt,
                      IDGenerator gen)
Creates a new ActionParticle with the given decision message and the given text.
Parameters:
msg - the decision message
txt - the situation-describing text
gen - the ID generator

ActionParticle

public ActionParticle(java.util.HashMap loaded)
Reconstructs an AP from a loaded String. Should only be called by the Loader class.
Parameters:
loaded - the HashMap with the loaded values
gen - the already initialized IDGenerator
See Also:
RpBase.RpBase(net.sourceforge.worldsaver.rp.RpBase, java.lang.String), Loader
Method Detail

getReferencesRight

public void getReferencesRight(java.util.HashMap pool,
                               IDGenerator gen)
Gets the references right after loading. Also called by the Loader class.
Specified by:
getReferencesRight in interface Saveable
Parameters:
pool - contains all objects of the current session
See Also:
RpBase.getReferencesRight(java.util.HashMap, net.sourceforge.worldsaver.util.IDGenerator), Saveable

getSubParticles

protected java.util.HashSet getSubParticles()
Returns the sub-particles of this particle.
Returns:
the particles

getID

public long getID()
Returns the object ID.
Returns:
the ID

getSaveableString

public java.lang.String getSaveableString()
                                   throws java.io.IOException
Returns the saveable String.
Specified by:
getSaveableString in interface Saveable
Returns:
the String
Throws:
java.io.IOException - if the objects are not valid
See Also:
Saveable

isEndOfTree

public boolean isEndOfTree()
Returns whether there is a deeper level of the action tree or not.
Returns:
true, if the action has come to an end.

addSubParticle

public void addSubParticle(ActionParticle val)
Adds another particle to this action tree (at this level).
Parameters:
val - the new particle

setDecisionMessage

public void setDecisionMessage(java.lang.String val)
Sets the decision message.
Parameters:
val - the message

setText

public void setText(java.lang.String val)
Sets the text explaining the situation.
Parameters:
val - the text

getDecisionMessage

public java.lang.String getDecisionMessage()
Returns the decision message.
Returns:
the message

getDecisionMessages

public java.lang.String[] getDecisionMessages()
Returns the decision messages of all following ActionParticles. Note that this are the messages from the next (deeper) level regarding the action tree!
Returns:
the messages

getText

public java.lang.String getText()
Returns the text describing the situation.
Returns:
the text