agentland.drug
Class DrugLordEHA

java.lang.Object
  |
  +--agentland.drug.DrugLordEHA

public class DrugLordEHA
extends Object
implements ExceptionHandler, DrugLord, Agent


Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
DrugLordEHA(MetagluePrimitives ap, AgentID agentID, Catalog c)
           
 
Method Summary
 void addMonitor(Spy param0)
          Add a log monitor that gets all the screen output.
 boolean alive()
           
 void changeTupleSet(DrugRequest param0, Vector param1)
          This lets dealers change the vector of tuples that might satisfy him.
 void changeUrg(DrugRequest param0, Urgency param1)
          This lets dealers change the urgency with which they have requested some tuple.
 Agent getAgent()
          get the internal stub used.
 AgentID getAgentID()
           
 AgentID getAgtID()
          get the internal agentID used.
 AgentID getMetaglueAgentID()
           
 void instantiate(Agent a)
           
 void replaceExceptionHandler(AgentExceptionHandler r)
           
 Tuple requestHit(Vector param0, DrugRequest param1)
          This is the most important part of our job.
 void setAgent(Agent a)
          set the internal stub used to passed agent.
 void setAgtID(AgentID a)
          set the internal agentID used to passed agent.
 void shutdown()
           
 void startup()
           
 InetAddress whereAreYou()
          Returns the InetAddress of the machine where the agent is running
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrugLordEHA

public DrugLordEHA(MetagluePrimitives ap,
                   AgentID agentID,
                   Catalog c)
            throws RemoteException
Method Detail

getAgent

public Agent getAgent()
Description copied from interface: ExceptionHandler
get the internal stub used. (Used for resource management interception)
Specified by:
getAgent in interface ExceptionHandler

setAgent

public void setAgent(Agent a)
Description copied from interface: ExceptionHandler
set the internal stub used to passed agent. (Used for resource management interception)
Specified by:
setAgent in interface ExceptionHandler

getAgtID

public AgentID getAgtID()
Description copied from interface: ExceptionHandler
get the internal agentID used. (Used for resource management interception)
Specified by:
getAgtID in interface ExceptionHandler

setAgtID

public void setAgtID(AgentID a)
Description copied from interface: ExceptionHandler
set the internal agentID used to passed agent. (Used for resource management interception)
Specified by:
setAgtID in interface ExceptionHandler

instantiate

public void instantiate(Agent a)
Specified by:
instantiate in interface ExceptionHandler

replaceExceptionHandler

public void replaceExceptionHandler(AgentExceptionHandler r)
Specified by:
replaceExceptionHandler in interface ExceptionHandler

addMonitor

public void addMonitor(Spy param0)
                throws RemoteException
Description copied from interface: Agent
Add a log monitor that gets all the screen output.
Specified by:
addMonitor in interface Agent

alive

public boolean alive()
              throws RemoteException
Specified by:
alive in interface Agent

getAgentID

public AgentID getAgentID()
Specified by:
getAgentID in interface Agent

getMetaglueAgentID

public AgentID getMetaglueAgentID()
                           throws RemoteException
Specified by:
getMetaglueAgentID in interface Agent

shutdown

public void shutdown()
              throws RemoteException
Specified by:
shutdown in interface Agent

startup

public void startup()
             throws RemoteException
Specified by:
startup in interface Agent

whereAreYou

public InetAddress whereAreYou()
                        throws RemoteException
Description copied from interface: Agent
Returns the InetAddress of the machine where the agent is running
Specified by:
whereAreYou in interface Agent

changeTupleSet

public void changeTupleSet(DrugRequest param0,
                           Vector param1)
                    throws RemoteException
Description copied from interface: DrugLord
This lets dealers change the vector of tuples that might satisfy him. He passes in the request he's changing, and the new vector of tuples.
Specified by:
changeTupleSet in interface DrugLord

changeUrg

public void changeUrg(DrugRequest param0,
                      Urgency param1)
               throws RemoteException
Description copied from interface: DrugLord
This lets dealers change the urgency with which they have requested some tuple. They can raise or lower it to indicate a change in urgency, or set it to Urgency.NONE to indicate they are done with their drug. Note that the request passed in should be the _old_ request, with the urgency not yet updated.
Specified by:
changeUrg in interface DrugLord

requestHit

public Tuple requestHit(Vector param0,
                        DrugRequest param1)
                 throws RemoteException
Description copied from interface: DrugLord
This is the most important part of our job. A dealer gives us a vector of tuples of drugs that would might satisfy him, and a drug request object that indicates the agentID of the addict and the general urgency that the request is being made at. We do some parsing, think about everything for a bit, and then pass back the tuple he can use (possibly null).
Specified by:
requestHit in interface DrugLord