agentland.drug
Class DrugLordAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.drug.DrugLordAgent

public class DrugLordAgent
extends AgentAgent
implements DrugLord

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
DrugLordAgent()
           
 
Method Summary
 void changeTupleSet(DrugRequest request, Vector tuples)
          This lets dealers change the vector of tuples that might satisfy him.
 void changeUrg(DrugRequest request, Urgency urg)
          This lets dealers change the urgency with which they have requested some tuple.
 Tuple requestHit(Vector tuples, DrugRequest request)
          This is the most important part of our job.
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, log, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOn, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DrugLordAgent

public DrugLordAgent()
              throws RemoteException
Method Detail

requestHit

public Tuple requestHit(Vector tuples,
                        DrugRequest request)
                 throws RemoteException
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

changeUrg

public void changeUrg(DrugRequest request,
                      Urgency urg)
               throws RemoteException
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

changeTupleSet

public void changeTupleSet(DrugRequest request,
                           Vector tuples)
                    throws RemoteException
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