modelling
Class CommunicatingAgent

java.lang.Object
  extended bysema.Element
      extended bysema.Agent
          extended bymodelling.CommunicatingAgent
All Implemented Interfaces:
Communicating, java.lang.Comparable

public class CommunicatingAgent
extends Agent
implements Communicating

Agent able to communicate with other agents.


Nested Class Summary
 class CommunicatingAgent.Discussion
          Action of discuting.
 
Nested classes inherited from class sema.Agent
Agent.Action
 
Nested classes inherited from class sema.Element
Element.ElementEvent
 
Field Summary
 
Fields inherited from class sema.Element
id, world
 
Constructor Summary
CommunicatingAgent(World world, Area area, float delay, java.awt.Image image)
           
 
Method Summary
 Communicating.Discussion getCurrentDiscussion()
          Returns the current discussion.
 boolean hear(java.lang.String speech, Communicating speaker)
          Receipts the speaker's words.
protected  void setCurrentDiscussion(CommunicatingAgent.Discussion speech)
          Allows to set the current discussion.
protected  boolean setNextAnswer(java.lang.String question, Communicating speaker)
          It computes the answer to give back from the 'question' of the speaker, if it decides no to answer it return false, else it return true and preselect the answer to give the next time we open the mouth ( action of the discussion )
 
Methods inherited from class sema.Agent
acceptAction, getDelay, registerAction, setDelay, unregisterAction
 
Methods inherited from class sema.Element
canTake, compareTo, death, draw, getArea, getDrawingPriority, getHeight, getIcon, getImage, getKind, getName, getProperties, highlight, highlight, isMarked, kill, setDrawingPriority, setHeight, setKind, setMarked, setProperties, toString, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommunicatingAgent

public CommunicatingAgent(World world,
                          Area area,
                          float delay,
                          java.awt.Image image)
Method Detail

setNextAnswer

protected boolean setNextAnswer(java.lang.String question,
                                Communicating speaker)
It computes the answer to give back from the 'question' of the speaker, if it decides no to answer it return false, else it return true and preselect the answer to give the next time we open the mouth ( action of the discussion )


getCurrentDiscussion

public Communicating.Discussion getCurrentDiscussion()
Returns the current discussion.

Specified by:
getCurrentDiscussion in interface Communicating

setCurrentDiscussion

protected void setCurrentDiscussion(CommunicatingAgent.Discussion speech)
Allows to set the current discussion.


hear

public boolean hear(java.lang.String speech,
                    Communicating speaker)
Receipts the speaker's words. Calls setNextAnswer to determinate the answer. Resumes eventually the current discussion.

Specified by:
hear in interface Communicating