agentland.drug
Class PipelineAgent

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

public class PipelineAgent
extends agentland.drug.connector.ConnectionMakerAgent
implements Pipeline, agentland.drug.connector.ConnectionMaker

See Also:
Serialized Form

Inner Class Summary
protected  class PipelineAgent.ConnectionInfo
           
 
Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class agentland.drug.connector.ConnectionMakerAgent
adjacencyMatrix, connections, lastConnectionID, lastNodeId, nodesByAgent, nodesById
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
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
PipelineAgent()
           
 
Method Summary
protected  int checkUrgency(int cid)
          checks how long ago the addict has been contacted to check how badly it needs the connection.
 ConnectionDrug connect(AgentID start, AgentID end, AgentID addict, Urgency urgency)
           
 ConnectionDrug connect(Drug start, Drug end, AgentID addict, Urgency urgency)
          Given two drugs, this method will find a path and connect it, provided that the urgency of this connection is equal or higher than the urgency of the cheapest available path from start to end.
 ConnectionDrug connect(int start, int stop)
          To be used from AgentTester.
protected  boolean connect(String in, AgentID agtID, String out)
          Call given agent and tell it to connect in and out.
protected  boolean connect(String in, Drug drug, String out)
          makes an agent read signal from input in and send it to output out; if a device represented by the agent has only inputs or only outputs, set in or out to null.
 boolean connectible(AgentID start, AgentID stop)
          tells you whether there exists a connection between a pair of drugs
protected  void connectPath(agentland.drug.connector.Path p)
          given a path, this method calls all intermediate agents and sets their inputs and outputs in such a way that the path is connected
protected  void removeConnection(int id)
          kills (resets to 0 cost) the connection with a given id and calls appropriate addicts to tell them that they have been deprived of drugs
 
Methods inherited from class agentland.drug.connector.ConnectionMakerAgent
addConnection, addNode, extendPath, getCheapestPath, getConnectionsFrom, getConnectPath, getNodeID
 
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

PipelineAgent

public PipelineAgent()
              throws RemoteException
Method Detail

connect

public ConnectionDrug connect(int start,
                              int stop)
                       throws RemoteException
To be used from AgentTester.
Specified by:
connect in interface Pipeline

connect

protected boolean connect(String in,
                          Drug drug,
                          String out)
makes an agent read signal from input in and send it to output out; if a device represented by the agent has only inputs or only outputs, set in or out to null. If both in and out are set to null, nothing happens

connect

protected boolean connect(String in,
                          AgentID agtID,
                          String out)
Call given agent and tell it to connect in and out.

connectPath

protected void connectPath(agentland.drug.connector.Path p)
given a path, this method calls all intermediate agents and sets their inputs and outputs in such a way that the path is connected

connect

public ConnectionDrug connect(Drug start,
                              Drug end,
                              AgentID addict,
                              Urgency urgency)
                       throws RemoteException
Given two drugs, this method will find a path and connect it, provided that the urgency of this connection is equal or higher than the urgency of the cheapest available path from start to end. addict is associated with the connection and whenever urgency info needs to be updated or when the connection needs to be revoked, the addict will be notified (via drug withdrawn)
Specified by:
connect in interface Pipeline

connect

public ConnectionDrug connect(AgentID start,
                              AgentID end,
                              AgentID addict,
                              Urgency urgency)
                       throws RemoteException
Specified by:
connect in interface Pipeline

removeConnection

protected void removeConnection(int id)
                         throws RemoteException
kills (resets to 0 cost) the connection with a given id and calls appropriate addicts to tell them that they have been deprived of drugs

connectible

public boolean connectible(AgentID start,
                           AgentID stop)
                    throws RemoteException
tells you whether there exists a connection between a pair of drugs
Specified by:
connectible in interface Pipeline

checkUrgency

protected int checkUrgency(int cid)
checks how long ago the addict has been contacted to check how badly it needs the connection. If the last check was performed long time ago, the addict is asked again. It the check was pefrormed recently, a cached value is returned.