modelling
Class ReceptiveAgent

java.lang.Object
  extended bysema.Element
      extended bysema.Agent
          extended bymodelling.ReceptiveAgent
All Implemented Interfaces:
java.lang.Comparable, Receptive

public class ReceptiveAgent
extends Agent
implements Receptive

Agent able to receive signals.


Nested Class Summary
 
Nested classes inherited from class sema.Agent
Agent.Action
 
Nested classes inherited from class sema.Element
Element.ElementEvent
 
Field Summary
protected  java.util.TreeMap sigToAction
          Known signals and actions corresponding.
 
Fields inherited from class sema.Element
id, world
 
Constructor Summary
ReceptiveAgent(World world, Area area, float delay, java.awt.Image image)
          Creates a new agent able to catch signals, with the same parameters than agent.
 
Method Summary
protected  boolean canCatch(Signal sig)
          Determinates whether the agent is currentyle able to receive this signal.
 void receiveSignal(Signal sig)
          Receives a signal.
protected  void sigToAction(Signal sig)
          Executes the corresponding action.
 
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
 

Field Detail

sigToAction

protected java.util.TreeMap sigToAction
Known signals and actions corresponding.

Constructor Detail

ReceptiveAgent

public ReceptiveAgent(World world,
                      Area area,
                      float delay,
                      java.awt.Image image)
Creates a new agent able to catch signals, with the same parameters than agent.

Method Detail

canCatch

protected boolean canCatch(Signal sig)
Determinates whether the agent is currentyle able to receive this signal.


sigToAction

protected void sigToAction(Signal sig)
Executes the corresponding action. If signal is unknown, does nothing.


receiveSignal

public void receiveSignal(Signal sig)
Receives a signal. Eventually dismisses it if cannot be catch (canCatch method).

Specified by:
receiveSignal in interface Receptive