jason.control
Class ExecutionControl

Package class diagram package ExecutionControl
java.lang.Object
  extended by jason.control.ExecutionControl
Direct Known Subclasses:
ExecutionControlGUI

public class ExecutionControl
extends java.lang.Object

Base class for the user implementation of execution control.

This default implementation synchronise the agents execution, i.e., each agent will perform its next reasoning cycle only when all agents have finished its reasoning cycle.

Execution sequence:


Field Summary
protected  ExecutionControlInfraTier infraControl
           
protected static java.util.logging.Logger logger
           
 
Constructor Summary
ExecutionControl()
           
 
Method Summary
protected  void allAgsFinished()
          Called when all agents have finished the current cycle
 int getCycleNumber()
           
protected  int getCycleTimeout()
          returns the maximum number of milliseconds of a cycle
 ExecutionControlInfraTier getExecutionControlInfraTier()
           
 int getNbAgs()
          Returns the number of agents in the MAS (used to test the end of a cycle)
 void init(java.lang.String[] args)
          This method is called when setExecutionControlInfraTier was already called
 boolean isRunning()
           
 void receiveFinishedCycle(java.lang.String agName, boolean breakpoint, int cycle)
          Called when the agent agName has finished its reasoning cycle.
 void setExecutionControlInfraTier(ExecutionControlInfraTier jasonControl)
           
 void setNbAgs(int n)
          Set the number of agents
 void setRunningCycle(boolean rc)
           
protected  void startNewCycle()
           
 void stop()
          This method is called when MAS execution is being finished
protected  boolean testEndCycle(java.util.Set<java.lang.String> finishedAgs)
          Returns true when a new cycle can start, it normally holds when all agents are in the finishedAgs set.
 java.lang.String toString()
           
 void updateNumberOfAgents()
          Updates the number of agents in the MAS, this default implementation, considers all agents in the MAS as actors .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

infraControl

protected ExecutionControlInfraTier infraControl

logger

protected static java.util.logging.Logger logger
Constructor Detail

ExecutionControl

public ExecutionControl()
Method Detail

getCycleTimeout

protected int getCycleTimeout()
returns the maximum number of milliseconds of a cycle


startNewCycle

protected void startNewCycle()

updateNumberOfAgents

public void updateNumberOfAgents()
Updates the number of agents in the MAS, this default implementation, considers all agents in the MAS as actors .


getNbAgs

public int getNbAgs()
Returns the number of agents in the MAS (used to test the end of a cycle)


setNbAgs

public void setNbAgs(int n)
Set the number of agents


receiveFinishedCycle

public void receiveFinishedCycle(java.lang.String agName,
                                 boolean breakpoint,
                                 int cycle)
Called when the agent agName has finished its reasoning cycle. breakpoint is true in case the agent selected one plan with "breakpoint" annotation.


testEndCycle

protected boolean testEndCycle(java.util.Set<java.lang.String> finishedAgs)
Returns true when a new cycle can start, it normally holds when all agents are in the finishedAgs set.

Parameters:
finishedAgs - the set of agents' name that already finished the current cycle

setExecutionControlInfraTier

public void setExecutionControlInfraTier(ExecutionControlInfraTier jasonControl)

getExecutionControlInfraTier

public ExecutionControlInfraTier getExecutionControlInfraTier()

init

public void init(java.lang.String[] args)
This method is called when setExecutionControlInfraTier was already called


stop

public void stop()
This method is called when MAS execution is being finished


allAgsFinished

protected void allAgsFinished()
Called when all agents have finished the current cycle


isRunning

public boolean isRunning()

getCycleNumber

public int getCycleNumber()

setRunningCycle

public void setRunningCycle(boolean rc)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object