agentland.drug
Class DealerAgent
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--metaglue.AgentAgent
|
+--agentland.util.GoodAgent
|
+--agentland.drug.DealerAgent
- public abstract class DealerAgent
- extends GoodAgent
- implements Dealer, Addict
- See Also:
- Serialized Form
Method Summary |
protected boolean |
checkOutDrug(Drug d,
Filter f)
Does the drug pass muster with the filter passed, and any other
stuff. |
boolean |
connect(AgentID start,
AgentID end)
|
boolean |
connect(Drug start,
Drug end)
If either start or end drugs are in the menu of this dealer, the
two methods below will connect the two drugs and associate the
connection with the drug dealt by this dealer. |
Urgency |
drugNeed(Drug drug)
|
void |
drugReplaced(Drug old_drug,
Drug new_drug)
|
void |
drugWithdrawn(Drug drug)
if a connection is withdrawn, it will find the drug that the connection
was attached to and it will withdraw that drug from the appropriate addict |
protected agentland.drug.DealerAgent.DrugInfo |
findDrug(AgentID a)
|
protected agentland.drug.DealerAgent.DrugInfo |
findDrug(ConnectionDrug cd)
finds drug info that uses ConnectionDrug cn |
protected agentland.drug.DealerAgent.DrugInfo |
findDrug(Drug d)
given a drug, it finds an appropriate entry in the the drugs
table and returns a DrugInfo object |
abstract Vector |
getMenu()
Return list of all drugs managed by this dealer. |
Drug |
requestHit(Drug drug,
Urgency urgency,
AgentID whoID)
|
Drug |
requestHit(Drug drug,
Urgency urgency,
AgentID who,
Filter f)
|
Drug |
requestHit(Urgency urgency,
Addict who,
Filter f)
|
Drug |
requestHit(Urgency urgency,
AgentID whoID)
|
Drug |
requestHit(Urgency urgency,
AgentID whoID,
Filter f)
|
protected agentland.drug.DealerAgent.Info |
takeDrug(int index,
Urgency urgency,
Addict who,
Filter f,
int level,
boolean real)
|
Methods inherited from class agentland.util.GoodAgent |
addSpy,
addSpy,
alert,
alertString,
beep,
error,
getAlert,
getHistory,
getHistoryElement,
getPersistentMap,
log,
notify,
removeSpy,
removeSpy,
resetHistory,
safeRely,
safeRely,
safeRely,
setNiceLogName,
tell |
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,
obtainMetaglueAgent,
obtainMetaglueAgent,
obtainMetaglueAgentByName,
reliesOn,
reliesOn,
reliesOn,
reliesOnSynch,
removeFrozen,
replaceExceptionHandler,
setFreezeName,
setLogLevel,
setLogName,
shutdown,
startAgent,
startAgentOn,
startAgentOn,
startup,
status,
tiedTo,
tiedTo,
tiedTo,
tiedTo,
tieToDesignation,
whereAreYou |
DealerAgent
public DealerAgent()
throws RemoteException
findDrug
protected agentland.drug.DealerAgent.DrugInfo findDrug(ConnectionDrug cd)
- finds drug info that uses ConnectionDrug cn
findDrug
protected agentland.drug.DealerAgent.DrugInfo findDrug(Drug d)
- given a drug, it finds an appropriate entry in the the drugs
table and returns a DrugInfo object
findDrug
protected agentland.drug.DealerAgent.DrugInfo findDrug(AgentID a)
drugNeed
public Urgency drugNeed(Drug drug)
throws RemoteException
- Specified by:
- drugNeed in interface Addict
drugWithdrawn
public void drugWithdrawn(Drug drug)
throws RemoteException
- if a connection is withdrawn, it will find the drug that the connection
was attached to and it will withdraw that drug from the appropriate addict
- Specified by:
- drugWithdrawn in interface Addict
drugReplaced
public void drugReplaced(Drug old_drug,
Drug new_drug)
throws RemoteException
- Specified by:
- drugReplaced in interface Addict
connect
public boolean connect(Drug start,
Drug end)
throws RemoteException
- If either start or end drugs are in the menu of this dealer, the
two methods below will connect the two drugs and associate the
connection with the drug dealt by this dealer. If the connection
is ever withdrawn, the appropriate drug addict will be notified
that the DRUG (not the connection) has been withdrawn The urgency
of the drug will be used for establishing the connection
- Specified by:
- connect in interface Dealer
connect
public boolean connect(AgentID start,
AgentID end)
throws RemoteException
- Specified by:
- connect in interface Dealer
requestHit
public Drug requestHit(Drug drug,
Urgency urgency,
AgentID whoID)
throws RemoteException
- Specified by:
- requestHit in interface Dealer
- Parameters:
whoID
- This is an agent id for an Addict.
requestHit
public Drug requestHit(Drug drug,
Urgency urgency,
AgentID who,
Filter f)
throws RemoteException
- Specified by:
- requestHit in interface Dealer
requestHit
public Drug requestHit(Urgency urgency,
AgentID whoID)
throws RemoteException
- Specified by:
- requestHit in interface Dealer
requestHit
public Drug requestHit(Urgency urgency,
AgentID whoID,
Filter f)
throws RemoteException
- Specified by:
- requestHit in interface Dealer
requestHit
public Drug requestHit(Urgency urgency,
Addict who,
Filter f)
throws RemoteException
takeDrug
protected agentland.drug.DealerAgent.Info takeDrug(int index,
Urgency urgency,
Addict who,
Filter f,
int level,
boolean real)
throws RemoteException
- Returns:
- number of unhappy folks (people who got no drug and did before)
checkOutDrug
protected boolean checkOutDrug(Drug d,
Filter f)
- Does the drug pass muster with the filter passed, and any other
stuff.
WARNING: BAD HACK--in resource/drug this method is overridden to do
metaglue host checks.
getMenu
public abstract Vector getMenu()
throws RemoteException
- Return list of all drugs managed by this dealer.
MUST BE OVERRIDDEN BY EXTENDER
- Specified by:
- getMenu in interface Dealer