|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.colorado.cs.ns2.agents.Agent
public abstract class Agent
This is a generic Agent class. This class must be extended and its methods may be overwritten to create new Agent subtypes.
Field Summary | |
---|---|
protected java.util.Vector<java.lang.String> |
acceptableConnectAgents
A vector of Agents that may be connected to the current Agent. |
protected int |
agentId
Agent identifier field uniquely identifying this agent. |
protected java.lang.String |
agentName
Agent name, as defined by NS2 (i.e., TCP, TCPSink, UDP, Null, etc.). |
protected java.util.Vector<Application> |
applications
A Vector of all applications attached to the current Agent. |
protected boolean |
isConnected
boolean Returns true if the current Agent is connected. |
protected int |
nodeId
Node identifier field which specifies to which node this agent is attached. |
protected java.lang.String |
variableName
Agent's TCL variable name. |
Constructor Summary | |
---|---|
Agent()
Default constructor - Instantiates local class variables. |
Method Summary | |
---|---|
java.lang.String |
addAgentToScript(int nodeId)
Returns the TCL code containing the instantiation of this Agent. |
boolean |
canConnectToAgent(Agent agent)
True or False regarding whether a connection is allowed. |
boolean |
canHaveMultipleConnections()
Returns true if the current Agent can support multiple connections. |
int |
getAgentId()
Returns the current Agent's unique identifier. |
java.lang.String |
getAgentName()
Returns the Agent's NS2 name. |
java.util.Vector |
getApplications()
Returns a Vector of applications that reside on this Agent. |
Application |
getApplicationsElementAt(int element)
Returns the Application at index element. |
int |
getNodeId()
Returns the Node identifier on which the current Agent is attached. |
java.lang.String |
getVariableName()
Returns the Agent's TCP variable name. |
boolean |
isConnected()
Returns whether the current Agent is connected to another Agent. |
void |
removeApplicationsElement(Application app)
An Application to remove from the Application Vector. |
void |
removeApplicationsElementAt(int element)
Removes the Application at index element from the Application Vector. |
void |
setAgentId(int agentId)
Sets the Agent's ID value. |
abstract void |
setAgentProperties()
Set the Agent's properties. |
void |
setApplications(Application app)
A new Application to add to this Agent's Application Vector. |
void |
setConnected(boolean isConnected)
Sets the current Agent's connected status to true or false. |
abstract java.lang.String |
writeAgentProperties()
Returns a TCP representation of the Agent's properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int agentId
protected int nodeId
protected java.lang.String agentName
protected java.lang.String variableName
protected java.util.Vector<java.lang.String> acceptableConnectAgents
Vector
protected boolean isConnected
Vector
protected java.util.Vector<Application> applications
Vector
Constructor Detail |
---|
public Agent()
Method Detail |
---|
public java.lang.String getAgentName()
public java.lang.String getVariableName()
public void setAgentId(int agentId)
An
- new Agent ID to set for the current Agent.public int getAgentId()
public int getNodeId()
public void setConnected(boolean isConnected)
Sets
- the current Agent's connected status to true or false.public boolean isConnected()
public boolean canConnectToAgent(Agent agent)
Tests
- whether a given Agent can be connected to the current Agent.
public java.lang.String addAgentToScript(int nodeId)
Adds
- an Agent with a given identifier to the output TCL script String
public boolean canHaveMultipleConnections()
public java.util.Vector getApplications()
Vector
public Application getApplicationsElementAt(int element)
element
- An index into the Application Vector
Application
public void removeApplicationsElementAt(int element)
element
- An index into the Application Vectorpublic void removeApplicationsElement(Application app)
An
- Application to remove from the Application Vector.Application
public void setApplications(Application app)
A
- new Application to add to this Agent's Application Vector.Application
public abstract void setAgentProperties()
public abstract java.lang.String writeAgentProperties()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |