es.upv.dsic.gti_ia.core
Class SingleAgent

java.lang.Object
  extended by es.upv.dsic.gti_ia.core.BaseAgent
      extended by es.upv.dsic.gti_ia.core.SingleAgent
All Implemented Interfaces:
Runnable

public abstract class SingleAgent
extends BaseAgent

This class defines an new agents template, extending of BaseAgent.

Author:
Ricard Lopez Fogues, Sergio Pajares Ferrando, Joan Bellver Faus

Field Summary
 
Fields inherited from class es.upv.dsic.gti_ia.core.BaseAgent
logger, session, traceSession
 
Constructor Summary
SingleAgent(AgentID aid)
          Creates a new SingleAgent
 
Method Summary
 void onMessage(ACLMessage msg)
          Every message received will be queued.
 ACLMessage receiveACLMessage()
          Receives a AclMessage taking into account a blocking reception
 
Methods inherited from class es.upv.dsic.gti_ia.core.BaseAgent
activateTraceService, changeIdentity, deactivateTraceService, execute, finalize, getAid, getName, init, onTraceEvent, run, send, sendTraceEvent, start, terminate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleAgent

public SingleAgent(AgentID aid)
            throws Exception
Creates a new SingleAgent

Parameters:
aid - Agent Id
connection - Connection the agent will use
Throws:
Exception - if agent id already exists on the platform
Method Detail

receiveACLMessage

public final ACLMessage receiveACLMessage()
                                   throws InterruptedException
Receives a AclMessage taking into account a blocking reception

Returns:
an ACLMessage
Throws:
InterruptedException
Exception

onMessage

public void onMessage(ACLMessage msg)
Every message received will be queued. This method is called automatically by the base class, which is BaseAgent.

Overrides:
onMessage in class BaseAgent
Parameters:
msg - Message received


Copyright © 2012 GTI-IA. All Rights Reserved.