|
From: <bro...@us...> - 2008-02-22 02:10:58
|
Revision: 124
http://gridsim.svn.sourceforge.net/gridsim/?rev=124&view=rev
Author: brobergj
Date: 2008-02-21 18:11:02 -0800 (Thu, 21 Feb 2008)
Log Message:
-----------
*Added comments and javadoc
Modified Paths:
--------------
branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java
Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java
===================================================================
--- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java 2008-02-22 02:10:46 UTC (rev 123)
+++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowPacket.java 2008-02-22 02:11:02 UTC (rev 124)
@@ -16,7 +16,6 @@
import gridsim.*;
import gridsim.net.Link;
import gridsim.net.Packet;
-import eduni.simjava.*;
/**
@@ -28,18 +27,18 @@
*/
public class FlowPacket implements Packet
{
- private int destID; // where the packet wants to go
+ private int destID; // where the flow wants to go
private int srcID; // sender ID
- private long size; // packet size (for calculating transmission time)
- private long remSize; // remaining packet size
+ private long size; // flow size (for calculating transmission time)
+ private long remSize; // remaining flow size
private Object obj; // the actual object, the type depends on context
private double bandwidth_; // Bottleneck baud rate
private int bottleneckID; // Bottleneck link ID
- private Vector baudRates_; // list of entity's baud rate
+ private Vector baudRates_; // list of entity's baud rate on path from source to dest
- private Vector links_;
+ private Vector links_; // list of entity's links on path from source to dest
// Sum of latency (delay) on path
private double latency;
@@ -63,7 +62,7 @@
private int pktID_; // a unique packet ID issued by an entity
/**
- * Constructs a network packet for data that fits into a single network
+ * Constructs a network flow for data that fits into a single network
* packet.
*
* @param data The data to be encapsulated.
@@ -96,6 +95,7 @@
this.latency = 0.0;
this.bandwidth_ = Double.MAX_VALUE;
this.baudRates_ = new Vector();
+ this.links_ = new Vector();
this.bottleneckID = -1;
}
@@ -362,14 +362,36 @@
return totalPkts;
}
+ /**
+ * Returns the current sum of latency over the path from source to dest.
+ *
+ * @return latency
+ * @pre $none
+ * @post $none
+ */
public double getLatency() {
return latency;
}
+ /**
+ * Adds to the current sum of latency over the path from source to dest.
+ *
+ * @param latency the latency of a given link
+ * @pre $none
+ * @post $none
+ */
public void addLatency(double latency) {
this.latency += latency;
}
+ /**
+ * Adds baud rate of current link, and sets bottleneck
+ * bandwidth and ID if the link is this flow's bottleneck
+ *
+ * @param link a given link
+ * @pre $none
+ * @post $none
+ */
public synchronized void addBaudRate(Link link)
{
double baudRate = link.getBaudRate();
@@ -385,14 +407,35 @@
}
}
+ /**
+ * Returns the current bottleneck bandwidth of this flow.
+ *
+ * @return bandwidth_
+ * @pre $none
+ * @post $none
+ */
public double getBandwidth_() {
return bandwidth_;
}
+ /**
+ * Sets the current bottleneck bandwidth of this flow.
+ *
+ * param bandwidth_ the current bottleneck bandwidth
+ * @pre $none
+ * @post $none
+ */
public synchronized void setBandwidth_(double bandwidth_) {
this.bandwidth_ = bandwidth_;
}
+ /**
+ * Adds current link, and calls addBaudRate() and addLatency()
+ *
+ * @param link a given link
+ * @pre $none
+ * @post $none
+ */
public synchronized void addLink(Link link)
{
if (links_ == null) {
@@ -404,38 +447,103 @@
this.addLatency(link.getDelay());
}
+ /**
+ * Returns the current start time of this flow.
+ *
+ * @return startTime
+ * @pre $none
+ * @post $none
+ */
public double getStartTime() {
return startTime;
}
+ /**
+ * Sets the current start time of this flow.
+ *
+ * @param startTime the time a flow begins holding at the destination
+ * @pre $none
+ * @post $none
+ */
public void setStartTime(double startTime) {
this.startTime = startTime;
}
+ /**
+ * Returns the last time a flow was updated (i.e. bottleneck
+ * bandwidth changed and forecast was recomputed)
+ *
+ * @return updateTime
+ * @pre $none
+ * @post $none
+ */
public double getUpdateTime() {
return updateTime;
}
+ /**
+ * Sets the last time a flow was updated (i.e. bottleneck
+ * bandwidth changed and forecast was recomputed)
+ *
+ * @param updateTime the time a flow's forecast was last updated
+ * @pre $none
+ * @post $none
+ */
public void setUpdateTime(double updateTime) {
this.updateTime = updateTime;
}
+ /**
+ * Returns the remaining size of a flow
+ *
+ * @return remSize
+ * @pre $none
+ * @post $none
+ */
public long getRemSize() {
return remSize;
}
+ /**
+ * Sets the remaining size of a flow
+ *
+ * param remSize the remaining size of a flow
+ * @pre $none
+ * @post $none
+ */
public void setRemSize(long remSize) {
this.remSize = remSize;
}
+ /**
+ * Returns a vector of links that make up this flow's path
+ *
+ * @return links_
+ * @pre $none
+ * @post $none
+ */
public Vector getLinks_() {
return links_;
}
+ /**
+ * Returns the FlowLink ID of the bottleneck of this flow
+ *
+ * @return bottleneckID
+ * @pre $none
+ * @post $none
+ */
public int getBottleneckID() {
return bottleneckID;
}
+ /**
+ * ets the FlowLink ID of the bottleneck of this flow
+ *
+ * param bottleneckID the ID of the bottleneck FlowLink
+ * @pre $none
+ * @post $none
+ */
public void setBottleneckID(int bottleneckID) {
this.bottleneckID = bottleneckID;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|