EASE.Agents.Engine
Class InstantiatedAgent

java.lang.Object
  |
  +--EASE.Agents.Engine.InstantiatedAgent
Direct Known Subclasses:
InstantiatedEngineer, InstantiatedManager

public abstract class InstantiatedAgent
extends java.lang.Object


Field Summary
private  java.util.Vector listeners
           
protected  java.util.Hashtable params
           
protected  InstantiatedAgent parent
           
private  double parentPriority
           
protected  boolean paused
           
protected  Engine sensingEngine
           
protected  InstantiatedSM sm
           
protected  GenericAgent template
           
private  boolean userFailEnded
           
private  boolean userSuccessEnded
           
 
Constructor Summary
InstantiatedAgent(GenericAgent template, java.util.Hashtable params, InstantiatedAgent parent)
           
 
Method Summary
 void addListener(AgentListener listener)
           
abstract  void endContract()
          This function is called when the agent that contracted this agent calls to end the contract.
abstract  boolean execute()
          This function is called by the layer controller allowing the agent to do any required execution.
 boolean failing()
          This method is called to see whether the agent is failing.
 java.lang.String getName()
          Get the name of the agent.
 java.util.Hashtable getParams()
          Get the params of the agent
 InstantiatedAgent getParent()
          Get the parent of this agent.
 java.lang.String getState()
          Get the name of the current state of the agent
protected  void notifyAllChangeListeners()
           
 void notifyChange()
           
 boolean paused()
          This method is called to see whether the agent is paused.
 double priority()
          Called to get the priority of the agent.
 java.lang.StringBuffer priorityTrace()
          Get a priority calculation trace
 boolean succeeded()
          This method is called to see whether the agent is in a success state.
abstract  boolean terminate()
          This method is called to see if the agent is still alive.
 java.lang.String toString()
          For display purposes.
 java.lang.StringBuffer transitionTrace()
           
 void userEndContract(boolean success)
          This function is called when the agent contract is broken by the user.
 void userPause(boolean pause)
          This function is called when the user pauses the agent.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

userFailEnded

private boolean userFailEnded

userSuccessEnded

private boolean userSuccessEnded

paused

protected boolean paused

sensingEngine

protected Engine sensingEngine

listeners

private java.util.Vector listeners

parentPriority

private double parentPriority

parent

protected InstantiatedAgent parent

params

protected java.util.Hashtable params

template

protected GenericAgent template

sm

protected InstantiatedSM sm
Constructor Detail

InstantiatedAgent

public InstantiatedAgent(GenericAgent template,
                         java.util.Hashtable params,
                         InstantiatedAgent parent)
Method Detail

execute

public abstract boolean execute()
This function is called by the layer controller allowing the agent to do any required execution.

Returns:
The boolean returned should be true if the agent wants something that the agent controller needs to do, for example terminating or starting contracts.


endContract

public abstract void endContract()
This function is called when the agent that contracted this agent calls to end the contract.

terminate

public abstract boolean terminate()
This method is called to see if the agent is still alive.

Returns false if still alive.


userEndContract

public void userEndContract(boolean success)
This function is called when the agent contract is broken by the user.

The parameter is used to indicate whether success or fail should be propogated up.


userPause

public void userPause(boolean pause)
This function is called when the user pauses the agent.
The manager overrides the function and pauses contracted agents.


failing

public boolean failing()
This method is called to see whether the agent is failing.


succeeded

public boolean succeeded()
This method is called to see whether the agent is in a success state.


paused

public boolean paused()
This method is called to see whether the agent is paused.


priority

public double priority()
Called to get the priority of the agent.


getParent

public InstantiatedAgent getParent()
Get the parent of this agent.


getName

public java.lang.String getName()
Get the name of the agent.


toString

public java.lang.String toString()
For display purposes.

Overrides:
toString in class java.lang.Object

getState

public java.lang.String getState()
Get the name of the current state of the agent

getParams

public java.util.Hashtable getParams()
Get the params of the agent

priorityTrace

public java.lang.StringBuffer priorityTrace()
Get a priority calculation trace

transitionTrace

public java.lang.StringBuffer transitionTrace()

notifyChange

public void notifyChange()

addListener

public void addListener(AgentListener listener)

notifyAllChangeListeners

protected void notifyAllChangeListeners()