vs.plotagent
Class BasicThreadManager

java.lang.Object
  extended by vs.plotagent.BasicThreadManager
All Implemented Interfaces:
IAgentModule, IThreadManager

public class BasicThreadManager
extends java.lang.Object
implements IThreadManager


Nested Class Summary
 
Nested classes/interfaces inherited from interface vs.plotagent.IThreadManager
IThreadManager.StoryPhase
 
Constructor Summary
BasicThreadManager(IPlotAgent owner)
           
 
Method Summary
 void addThread(java.lang.String threadString)
          Tries to start the given thread.
 void assignResolutionGoal(Goal goal, PlotThread thread)
          Assigns a resolution goal to a character.
 void executeThread(PlotThread thread)
          Executes the thread, meaning that setting and characters are set up.
 void finishThread(PlotThread thread)
          Signals that a thread is finished (i.e. that a character has achieved his resolution goal
 IAgent getAgent()
          To get the Agent
 PlotThread getCurrentThread()
          Determines what the current thread is
 java.util.Vector<java.lang.String> getPossibleThreads()
          Determines all possible threads and returns their Prolog identifier strings
 java.util.Vector<Goal> getThreadGoals(java.lang.String characterURI)
          Retrieves the episodic goals, defined for certain character, if any.
 void setPhase(IThreadManager.StoryPhase phase)
           
 boolean startingThread()
          Returns whether the thread manager is trying to start an thread at this point
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicThreadManager

public BasicThreadManager(IPlotAgent owner)
Method Detail

finishThread

public void finishThread(PlotThread thread)
Signals that a thread is finished (i.e. that a character has achieved his resolution goal

Specified by:
finishThread in interface IThreadManager

addThread

public void addThread(java.lang.String threadString)
Description copied from interface: IThreadManager
Tries to start the given thread. If it is not already possible, it will be added to the plot goal manager in an attempt to make this possible.

Specified by:
addThread in interface IThreadManager

executeThread

public void executeThread(PlotThread thread)
Description copied from interface: IThreadManager
Executes the thread, meaning that setting and characters are set up.

Specified by:
executeThread in interface IThreadManager
Parameters:
thread - the thread to execute.

setPhase

public void setPhase(IThreadManager.StoryPhase phase)

assignResolutionGoal

public void assignResolutionGoal(Goal goal,
                                 PlotThread thread)
Assigns a resolution goal to a character.

Specified by:
assignResolutionGoal in interface IThreadManager
Parameters:
goal - the goal to assign to the character (the character is embedded in the goal)
thread - the plot thread this assignment comes from; used for logging purposes

getAgent

public IAgent getAgent()
Description copied from interface: IAgentModule
To get the Agent

Specified by:
getAgent in interface IAgentModule
Returns:
an Agent that owns this module

getCurrentThread

public PlotThread getCurrentThread()
Description copied from interface: IThreadManager
Determines what the current thread is

Specified by:
getCurrentThread in interface IThreadManager
Returns:
a prolog string representing the thread identifier

getPossibleThreads

public java.util.Vector<java.lang.String> getPossibleThreads()
Description copied from interface: IThreadManager
Determines all possible threads and returns their Prolog identifier strings

Specified by:
getPossibleThreads in interface IThreadManager
Returns:
the prolog strings representing the thread identifiers (e.g. thread-on-ship(X))

getThreadGoals

public java.util.Vector<Goal> getThreadGoals(java.lang.String characterURI)
Description copied from interface: IThreadManager
Retrieves the episodic goals, defined for certain character, if any.

Specified by:
getThreadGoals in interface IThreadManager
Parameters:
characterURI - the URI of the character to retrieve episodic goals for
Returns:
its episodic goals

startingThread

public boolean startingThread()
Description copied from interface: IThreadManager
Returns whether the thread manager is trying to start an thread at this point

Specified by:
startingThread in interface IThreadManager
Returns:
true if an thread is being started, false if not