edu.colorado.cs.ns2.agents
Class CBRAgent

java.lang.Object
  extended by edu.colorado.cs.ns2.agents.Application
      extended by edu.colorado.cs.ns2.agents.CBRAgent
All Implemented Interfaces:
java.io.Serializable

public class CBRAgent
extends Application

Class for Representing Constant Bit Rate Application on top of a UDP Agent.

Author:
Kevin Bauer, Pushkar Sambhoos.
See Also:
Serialized Form

Nested Class Summary
 class CBRAgent.CBRPropertiesDialog
          This nested class is responsible for creating a dialog box and retrieving the CBRAgent's properties from the user.
 
Field Summary
private  int packetSize_
          Stores the CBR Agent's TCL packetSize_ field.
private  boolean random_
          Stores the CBR Agent's TCL random_ field.
private  double rate_
          Stores the CB Agent's TCL rate_ field.
private static long serialVersionUID
          Generated serial version UID.
private  java.lang.String type_
          Stores the CBR Agent's TCL type_ field.
 
Fields inherited from class edu.colorado.cs.ns2.agents.Application
acceptableConnectAgents, agentId, applicationId, applicationName, nodeId, startEventScheduled, stopEventScheduled, variableName
 
Constructor Summary
CBRAgent(int nextId, int nodeId, int agentId)
          Default Constructor
 
Method Summary
 java.lang.String addApplicationToScript(NsNode node, int agentElement)
          Returns the String to be Written for the CBR Application
 int getPacketSize_()
          Returns the TCL packetSize_ value.
 double getRate_()
          Returns the value of rate_.
 java.lang.String getType_()
          Returns the CBR type_ field.
 boolean isRandom_()
          Returns True if random_ should be set.
protected  void setAcceptableConnectAgents()
          Sets the Vector of acceptable agents on which a CBRAgent may attach.
 void setPacketSize_(int packetSize_)
          Sets the TCL packetSize_ variable.
 void setProperties()
          Sets the properties for the CBRAgent via a JDialogBox interface
 void setRandom_(boolean random_)
          Sets random_ to True or False.
 void setRate_(double rate_)
          Sets the CBR rate_ field.
 void setType_(java.lang.String type_)
          Sets the CBR type_ field.
 java.lang.String toString()
          Returns a String representation of a CBRAgent object.
 
Methods inherited from class edu.colorado.cs.ns2.agents.Application
getAcceptableAgents, getAgentId, getApplicatinName, getApplicationId, getApplicationName, getNodeId, getVariableName, isStartEventScheduled, isStopEventScheduled, setAgentId, setApplicatioName, setApplicationId, setApplicationName, setNodeId, setStartEventScheduled, setStopEventScheduled, setVariableName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Generated serial version UID.

See Also:
Constant Field Values

type_

private java.lang.String type_
Stores the CBR Agent's TCL type_ field.


packetSize_

private int packetSize_
Stores the CBR Agent's TCL packetSize_ field.


rate_

private double rate_
Stores the CB Agent's TCL rate_ field.


random_

private boolean random_
Stores the CBR Agent's TCL random_ field.

Constructor Detail

CBRAgent

public CBRAgent(int nextId,
                int nodeId,
                int agentId)
Default Constructor

Parameters:
nextId - Agent/ Application id - Globally Incremented.
nodeId - Associates with this Node.
Method Detail

setAcceptableConnectAgents

protected void setAcceptableConnectAgents()
Sets the Vector of acceptable agents on which a CBRAgent may attach.

Specified by:
setAcceptableConnectAgents in class Application

addApplicationToScript

public java.lang.String addApplicationToScript(NsNode node,
                                               int agentElement)
Returns the String to be Written for the CBR Application

Specified by:
addApplicationToScript in class Application
Parameters:
node - The Node to Attach Application To
agentElement - Index of Agent to which Application is to be attached.
Returns:
String to be written to Script.

getPacketSize_

public int getPacketSize_()
Returns the TCL packetSize_ value.

Returns:
The TCL packetSize_ value.

setPacketSize_

public void setPacketSize_(int packetSize_)
Sets the TCL packetSize_ variable.

Parameters:
packetSize_ - A new packet size.

isRandom_

public boolean isRandom_()
Returns True if random_ should be set.

Returns:
True or False whether random_ is set.

setRandom_

public void setRandom_(boolean random_)
Sets random_ to True or False.

Parameters:
random_ - New value for random_.

getRate_

public double getRate_()
Returns the value of rate_.

Returns:
The value of rate_.

setRate_

public void setRate_(double rate_)
Sets the CBR rate_ field.

Parameters:
rate_ - The new rate_ value.

getType_

public java.lang.String getType_()
Returns the CBR type_ field.

Returns:
The CBR type_ field.

setType_

public void setType_(java.lang.String type_)
Sets the CBR type_ field.

Parameters:
type_ - A new value for type_.

toString

public java.lang.String toString()
Returns a String representation of a CBRAgent object.

Overrides:
toString in class java.lang.Object

setProperties

public void setProperties()
Sets the properties for the CBRAgent via a JDialogBox interface

Specified by:
setProperties in class Application