|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.colorado.cs.ns2.sys.GenerateScript
public class GenerateScript
This class is responsible for handling all file I/O operations necessary for writing the TCL script to disk.
Field Summary | |
---|---|
private java.io.BufferedWriter |
out
A buffered file writer. |
private java.lang.String |
templateString
The TCL script in memory. |
Constructor Summary | |
---|---|
GenerateScript()
Default constructor. |
Method Summary | |
---|---|
java.lang.String |
getTemplateString()
Returns the TCL code as a String. |
void |
insertBlankLine()
Insert a new endline character in the TCL script. |
void |
insertBlankLine(int n)
Inserts n blank lines into the TCL script. |
void |
readTemplate()
Read the generic NS2 initialization TCL code. |
void |
setTemplateString(java.lang.String templateString)
Sets the TCL code String. |
java.lang.String |
toString()
Returns the TCL script. |
void |
writeAgent(Agent agent,
NsNode node)
Write an Agent declaration to the TCL script. |
void |
writeApplication(NsNode node,
int agentElement,
Application app)
Write an Application declaration to the TCL script. |
void |
writeConnectAgents(Agent agent1,
Agent agent2)
Write a new Agent connection to the TCL script. |
void |
writeCreateFlowColors()
Create color scheme for flows 1, 2, and 3 |
void |
writeCreateLink(Link link)
Write a link declaration to the TCL script. |
void |
writeCreateNode(NsNode node)
Write a node variable declaration to the TCL script. |
void |
writeEvent(java.lang.String s)
Write a simulation event to the TCL script. |
void |
writeRouting(java.lang.String routingProto)
Write routing information to the TCL script. |
void |
writeScript(java.lang.String fileName)
Write the script to disk. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.io.BufferedWriter out
private java.lang.String templateString
Constructor Detail |
---|
public GenerateScript()
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public void writeCreateFlowColors()
public void writeCreateNode(NsNode node)
node
- A new node to append to the TCL script.public void writeCreateLink(Link link)
link
- The link to add to the TCL script.public void writeAgent(Agent agent, NsNode node)
agent
- The Agent to add to the script.node
- The Node on which the Agent resides.public void writeApplication(NsNode node, int agentElement, Application app)
node
- The node on which the Application exists.agentElement
- The index of the agent in the Application Object's Agent list.app
- A reference to the Application to append.public void writeConnectAgents(Agent agent1, Agent agent2)
agent1
- The first agent in the connection.agent2
- The second agent in the connection.public void writeEvent(java.lang.String s)
s
- The TCL code for the new event.public void writeScript(java.lang.String fileName)
fileName
- The name of the TCL output file.public void readTemplate()
public java.lang.String getTemplateString()
public void setTemplateString(java.lang.String templateString)
templateString
- A new TCL code String.public void insertBlankLine()
public void insertBlankLine(int n)
n
- The number of blank lines to append to the TCL script.public void writeRouting(java.lang.String routingProto)
routingProto
- The desired routing protocol.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |