gps.protocol
Class Protocol

java.lang.Object
  extended by gps.protocol.Protocol
Direct Known Subclasses:
BT

public class Protocol
extends java.lang.Object

Protocol base class, all specific protocols inherit from it.

Version:
1.2, 6/20/2005
Author:
Weishuai Yang

Constructor Summary
Protocol()
          dummy constructor
 
Method Summary
 void confAgents()
          configure agents for this protocol, to be overriden
 void confDocuments()
          configure documents for this protocol, to be overriden
 void confEvents()
          configure events for this protocol, to be overriden
 Agent getAgent(int id)
          gets the agent instance from it's id
 Agent[] getAgentList()
          gets agent object list
 double getDelayAgent(Agent agent1, Agent agent2)
          gets delay between two agents
 double getDelayAgent(int agent1, int agent2)
          gets delay between two agents
 java.util.Properties getProtocolProperties()
          gets protocol properties
 java.util.Properties getSimulatorProperties()
          gets simulator properties
 void loadProtocolProperties(java.lang.String path)
          loads protocol properties, to be overriden
 void reset()
          resets status
 void setAgent(int index, Agent a)
          sets an agent object at the specified locaiton
 void setAgentNum(int num)
          sets agent number
 void setAgentNum(int snum, int pnum)
          sets the agent number in this topology, this method is used for p2p networks with servers and peers
 void setPAgent(int index, Peer p)
          sets an pagent object at the specified locaiton
 java.util.Properties setProtocolProperties(java.util.Properties p)
          sets protocol properties
 void setSAgent(int index, Server s)
          sets an sagent object at the specified locaiton
 void setSimulatorProperties(java.util.Properties p)
          sets simulator properties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Protocol

public Protocol()
dummy constructor

Method Detail

reset

public void reset()
resets status


loadProtocolProperties

public void loadProtocolProperties(java.lang.String path)
loads protocol properties, to be overriden

Parameters:
path - path to the configuration file

getSimulatorProperties

public java.util.Properties getSimulatorProperties()
gets simulator properties

Returns:
simulator properties

setSimulatorProperties

public void setSimulatorProperties(java.util.Properties p)
sets simulator properties

Parameters:
p - simulator properties

getProtocolProperties

public java.util.Properties getProtocolProperties()
gets protocol properties

Returns:
protocol properties

setProtocolProperties

public java.util.Properties setProtocolProperties(java.util.Properties p)
sets protocol properties

Parameters:
p - protocol properties

getDelayAgent

public double getDelayAgent(int agent1,
                            int agent2)
gets delay between two agents

Parameters:
agent1 - source agent id
agent2 - destination agent id

getDelayAgent

public double getDelayAgent(Agent agent1,
                            Agent agent2)
gets delay between two agents

Parameters:
agent1 - source agent
agent2 - destination agent

getAgent

public Agent getAgent(int id)
gets the agent instance from it's id

Parameters:
id - agent id

getAgentList

public Agent[] getAgentList()
gets agent object list

Returns:
array of agents

setAgentNum

public void setAgentNum(int num)
sets agent number

Parameters:
num - new agent number

setAgent

public void setAgent(int index,
                     Agent a)
sets an agent object at the specified locaiton

Parameters:
index - the index of the agent
a - agent object

setAgentNum

public void setAgentNum(int snum,
                        int pnum)
sets the agent number in this topology, this method is used for p2p networks with servers and peers

Parameters:
snum - is number of peer agents
pnum - is number of server agents

setSAgent

public void setSAgent(int index,
                      Server s)
sets an sagent object at the specified locaiton

Parameters:
index - the index of the sagent
s - sagent object

setPAgent

public void setPAgent(int index,
                      Peer p)
sets an pagent object at the specified locaiton

Parameters:
index - the index of the pagent
p - pagent object

confDocuments

public void confDocuments()
configure documents for this protocol, to be overriden


confEvents

public void confEvents()
configure events for this protocol, to be overriden


confAgents

public void confAgents()
configure agents for this protocol, to be overriden