|
From: <sul...@us...> - 2007-08-22 02:42:57
|
Revision: 28
http://gridsim.svn.sourceforge.net/gridsim/?rev=28&view=rev
Author: sulistio
Date: 2007-08-21 19:42:56 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
modify this class since a common interface NetIO has been introduced.
Modified Paths:
--------------
branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java
branches/gridsim4.0-branch2/source/gridsim/net/Input.java
branches/gridsim4.0-branch2/source/gridsim/net/Output.java
branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java
branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowOutput.java
Modified: branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java
===================================================================
--- branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2007-08-22 02:41:03 UTC (rev 27)
+++ branches/gridsim4.0-branch2/source/gridsim/GridSimCore.java 2007-08-22 02:42:56 UTC (rev 28)
@@ -194,8 +194,9 @@
protected Sim_port output;
// Output port but only for a network extension.
- private Output out_ = null;
- private FlowOutput fout_ = null;
+ private NetIO out_ = null;
+ //private Output out_ = null;
+ //private FlowOutput fout_ = null; // TODO: redundant
// TODO: new addition
@@ -264,15 +265,6 @@
super.add_port(input);
super.add_port(output);
- /************ // TODO: addition
- // Every GridSim entity with network has its own input/output channels.
- // Connect this entity "input" port to its input buffer "in_port"
- new Input("Input_" + name, baudRate);
- Sim_system.link_ports(name, "input", "Input_" + name, "input_buffer");
-
- new Output("Output_" + name, baudRate);
- Sim_system.link_ports(name, "output", "Output_"+name, "output_buffer");
- ************/
initNetwork(name, baudRate, null);
}
@@ -313,17 +305,6 @@
super.add_port(input);
super.add_port(output);
- /************ // TODO: addition
- // Every GridSim entity with network has its own input/output channels.
- // Connect this entity "input" port to its input buffer "in_port"
- Input in = new Input("Input_" + name, link_.getBaudRate());
- in.addLink(link_);
- Sim_system.link_ports(name, "input", "Input_" + name, "input_buffer");
-
- out_ = new Output("Output_" + name, link_.getBaudRate());
- out_.addLink(link_);
- Sim_system.link_ports(name, "output", "Output_"+name, "output_buffer");
- ************/
initNetwork(name, link.getBaudRate(), link);
}
@@ -332,20 +313,22 @@
{
// Every GridSim entity with network has its own input/output channels.
// Connect this entity "input" port to its input buffer "in_port"
- Input in = null;
- FlowInput fin = null;
-
+ NetIO in = null;
+ //FlowInput fin = null; // TODO: redundant
+
if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_PACKET_LEVEL)
{
- in = new Input("Input_" + name, baudRate);
+ in = new Input("Input_" + name, baudRate);
out_ = new Output("Output_" + name, baudRate);
}
else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_FLOW_LEVEL)
{
// TODO: ...
- fin = new FlowInput("Input_" + name, baudRate);
- fout_ = new FlowOutput("Output_" + name, baudRate);
-
+ //fin = new FlowInput("Input_" + name, baudRate);
+ //fout_ = new FlowOutput("Output_" + name, baudRate);
+ in = new FlowInput("Input_" + name, baudRate);
+ out_ = new FlowOutput("Output_" + name, baudRate);
+
}
else if (GridSimCore.NETWORK_TYPE == GridSimTags.NET_BUFFER_PACKET_LEVEL)
{
Modified: branches/gridsim4.0-branch2/source/gridsim/net/Input.java
===================================================================
--- branches/gridsim4.0-branch2/source/gridsim/net/Input.java 2007-08-22 02:41:03 UTC (rev 27)
+++ branches/gridsim4.0-branch2/source/gridsim/net/Input.java 2007-08-22 02:42:56 UTC (rev 28)
@@ -11,6 +11,8 @@
import gridsim.*;
import gridsim.net.*;
+import gridsim.util.TrafficGenerator;
+import java.util.Collection;
import eduni.simjava.*;
/**
@@ -29,7 +31,7 @@
* @since GridSim Toolkit 1.0
* @invariant $none
*/
-public class Input extends Sim_entity
+public class Input extends Sim_entity implements NetIO
{
private Sim_port inPort_;
private Link link_;
@@ -64,8 +66,10 @@
* @pre link != null
* @post $none
*/
- public void addLink(Link link) {
+ public void addLink(Link link)
+ {
this.link_ = link;
+ baudRate_ = link_.getBaudRate();
}
/**
@@ -113,6 +117,37 @@
}
/**
+ * This is an empty method and only applicable to
+ * {@link gridsim.net.Output} class.
+ * @param gen a background traffic generator
+ * @param userName a collection of user entity name (in String object).
+ * @return <tt>false</tt> since this method is not used by this class.
+ * @pre gen != null
+ * @pre userName != null
+ * @post $none
+ * @see gridsim.net.Output
+ */
+ public boolean setBackgroundTraffic(TrafficGenerator gen,
+ Collection userName)
+ {
+ return false;
+ }
+
+ /**
+ * This is an empty method and only applicable to
+ * {@link gridsim.net.Output} class.
+ * @param gen a background traffic generator
+ * @return <tt>false</tt> since this method is not used by this class.
+ * @pre gen != null
+ * @post $none
+ * @see gridsim.net.Output
+ */
+ public boolean setBackgroundTraffic(TrafficGenerator gen)
+ {
+ return false;
+ }
+
+ /**
* A method that gets one process event at one time until the end
* of a simulation, then delivers an event to the entity (its parent)
* @pre $none
Modified: branches/gridsim4.0-branch2/source/gridsim/net/Output.java
===================================================================
--- branches/gridsim4.0-branch2/source/gridsim/net/Output.java 2007-08-22 02:41:03 UTC (rev 27)
+++ branches/gridsim4.0-branch2/source/gridsim/net/Output.java 2007-08-22 02:42:56 UTC (rev 28)
@@ -31,7 +31,7 @@
* @since GridSim Toolkit 1.0
* @invariant $none
*/
-public class Output extends Sim_entity
+public class Output extends Sim_entity implements NetIO
{
private Sim_port outPort_; // output port
private Link link_; // a link to this output entity
@@ -180,6 +180,7 @@
public void addLink(Link link)
{
this.link_ = link;
+ baudRate_ = link_.getBaudRate();
packetList_ = new Vector();
}
Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java
===================================================================
--- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java 2007-08-22 02:41:03 UTC (rev 27)
+++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowInput.java 2007-08-22 02:42:56 UTC (rev 28)
@@ -1,15 +1,12 @@
/*
- * ** Network and Service Differentiation Extensions to GridSim 4.0 **
+ * Title: GridSim Toolkit
+ * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation
+ * of Parallel and Distributed Systems such as Clusters and Grids
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
- * James Broberg
- *
- * August 2007
- *
- * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
- *
- * FlowInput.java - GridSim Input class defines a port through which a simulation entity
- * receives data flows from the simulated network.
- *
+ * Author: James Broberg
+ * Organization: The University of Melbourne, Australia
+ * Created on:
*/
package gridsim.net.flow;
@@ -17,6 +14,8 @@
import gridsim.*;
import gridsim.net.*;
import eduni.simjava.*;
+import gridsim.util.TrafficGenerator;
+import java.util.Collection;
/**
* GridSim Input class defines a port through which a simulation entity
@@ -30,11 +29,11 @@
* and data length. Simultaneous inputs can be modeled using multiple
* instances of this class.
*
- * @author Manzur Murshed and Rajkumar Buyya
- * @since GridSim Toolkit 1.0
+ * @author James Broberg
+ * @since GridSim Toolkit 4.0
* @invariant $none
*/
-public class FlowInput extends Sim_entity
+public class FlowInput extends Sim_entity implements NetIO
{
private Sim_port inPort_;
private Link link_;
@@ -76,45 +75,42 @@
/**
* Gets the baud rate
* @return the baud rate
- * @deprecated As of GridSim 2.1, replaced by {@link #getBaudRate()}
* @pre $none
* @post $result >= 0.0
*/
- public double GetBaudRate() {
- return this.getBaudRate();
- }
-
- /**
- * Gets the baud rate
- * @return the baud rate
- * @pre $none
- * @post $result >= 0.0
- */
public double getBaudRate() {
return baudRate_;
}
/**
- * Gets the I/O real number based on a given value
- * @param value the specified value
- * @return real number
- * @deprecated As of GridSim 2.1, replaced by {@link #realIO(double)}
- * @pre value >= 0.0
- * @post $result >= 0.0
+ * This is an empty method and only applicable to
+ * {@link gridsim.net.Output} class.
+ * @param gen a background traffic generator
+ * @param userName a collection of user entity name (in String object).
+ * @return <tt>false</tt> since this method is not used by this class.
+ * @pre gen != null
+ * @pre userName != null
+ * @post $none
+ * @see gridsim.net.Output
*/
- public double real_io(double value) {
- return this.realIO(value);
+ public boolean setBackgroundTraffic(TrafficGenerator gen,
+ Collection userName)
+ {
+ return false;
}
/**
- * Gets the I/O real number based on a given value
- * @param value the specified value
- * @return real number
- * @pre value >= 0.0
- * @post $result >= 0.0
+ * This is an empty method and only applicable to
+ * {@link gridsim.net.Output} class.
+ * @param gen a background traffic generator
+ * @return <tt>false</tt> since this method is not used by this class.
+ * @pre gen != null
+ * @post $none
+ * @see gridsim.net.Output
*/
- public double realIO(double value) {
- return GridSimRandom.realIO(value);
+ public boolean setBackgroundTraffic(TrafficGenerator gen)
+ {
+ return false;
}
/**
Modified: branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowOutput.java
===================================================================
--- branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowOutput.java 2007-08-22 02:41:03 UTC (rev 27)
+++ branches/gridsim4.0-branch2/source/gridsim/net/flow/FlowOutput.java 2007-08-22 02:42:56 UTC (rev 28)
@@ -1,14 +1,12 @@
/*
- * ** Network and Service Differentiation Extensions to GridSim 4.0 **
+ * Title: GridSim Toolkit
+ * Description: GridSim (Grid Simulation) Toolkit for Modeling and Simulation
+ * of Parallel and Distributed Systems such as Clusters and Grids
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
- * James Broberg
- *
- * August 2007
- *
- * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
- *
- * Flow.java - Simulates a network flow
- *
+ * Author: James Broberg
+ * Organization: The University of Melbourne, Australia
+ * Created on:
*/
package gridsim.net.flow;
@@ -31,11 +29,11 @@
* communication delay. Simultaneous outputs can be modeled by using multiple
* instances of this class
*
- * @author Manzur Murshed and Rajkumar Buyya
- * @since GridSim Toolkit 1.0
+ * @author James Broberg
+ * @since GridSim Toolkit 4.1
* @invariant $none
*/
-public class FlowOutput extends Sim_entity
+public class FlowOutput extends Sim_entity implements NetIO
{
private Sim_port outPort_; // output port
private Link link_; // a link to this output entity
@@ -190,48 +188,14 @@
/**
* Gets the baud rate
* @return the baud rate
- * @deprecated As of GridSim 2.1, replaced by {@link #getBaudRate()}
* @pre $none
* @post $result >= 0.0
*/
- public double GetBaudRate() {
- return this.getBaudRate();
- }
-
- /**
- * Gets the baud rate
- * @return the baud rate
- * @pre $none
- * @post $result >= 0.0
- */
public double getBaudRate() {
return baudRate_;
}
/**
- * Gets the I/O real number based on a given value
- * @param value the specified value
- * @return real number
- * @deprecated As of GridSim 2.1, replaced by {@link #realIO(double)}
- * @pre $none
- * @post $result >= 0.0
- */
- public double real_io(double value) {
- return this.realIO(value);
- }
-
- /**
- * Gets the I/O real number based on a given value
- * @param value the specified value
- * @return real number
- * @pre $none
- * @post $result >= 0.0
- */
- public double realIO(double value) {
- return GridSimRandom.realIO(value);
- }
-
- /**
* A method that gets one process event at one time until the end
* of a simulation, then delivers an event to the entity (its parent)
* @pre $none
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|