gps.network
Class Topology

java.lang.Object
  extended by gps.network.Topology

public class Topology
extends java.lang.Object

provides network topology information

Version:
1.0, 4/18/2005
Author:
Weishuai Yang

Constructor Summary
Topology()
          dummy constructor
 
Method Summary
 double calcBandwidth(double mss, double rtt, double p, double c, double delay)
          calculate bandwidth through tcp formula
 void confNetwork(Graph g, java.util.Properties p)
          constructs topology from graph file and properties
 double getAvailableBandwidth(Link l)
          gets available bandwidth of a link
 double getBandwidth(Link l)
          gets bandwidth of a link
 double getDelay(int node1, int node2)
          gets delay between two nodes represented by id
 double getDelay(Node node1, Node node2)
          gets delay between two nodes
static Topology getInstance()
          gets the singleton instance of topology
 Link getLinkBetween(Node node1, Node node2)
          gets link between two directly connected nodes
 Link[] getLinks()
          gets all links
 Link[] getLinksBetween(Node node1, Node node2)
          gets links between two nodes, which may or may not connect to each other
 Node getNode(int id)
          gets the node instance from it's id
 Node[] getNodes()
          gets all nodes
 void reset()
          resets topology
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Topology

public Topology()
dummy constructor

Method Detail

getInstance

public static Topology getInstance()
gets the singleton instance of topology

Returns:
topology instance

reset

public void reset()
resets topology


getDelay

public double getDelay(int node1,
                       int node2)
gets delay between two nodes represented by id

Parameters:
node1 - source node id
node2 - destination node id
Returns:
delay

getDelay

public double getDelay(Node node1,
                       Node node2)
gets delay between two nodes

Parameters:
node1 - source node
node2 - destination node
Returns:
delay

getBandwidth

public double getBandwidth(Link l)
gets bandwidth of a link

Parameters:
l - the link
Returns:
bandwidth

getAvailableBandwidth

public double getAvailableBandwidth(Link l)
gets available bandwidth of a link

Parameters:
l - the link
Returns:
available bandwidth

getNode

public Node getNode(int id)
gets the node instance from it's id

Parameters:
id - node id
Returns:
node

getNodes

public Node[] getNodes()
gets all nodes

Returns:
array of nodes

getLinks

public Link[] getLinks()
gets all links

Returns:
array of links

confNetwork

public void confNetwork(Graph g,
                        java.util.Properties p)
constructs topology from graph file and properties

Parameters:
g - graph object
p - simulator properties

getLinksBetween

public Link[] getLinksBetween(Node node1,
                              Node node2)
gets links between two nodes, which may or may not connect to each other

Parameters:
node1 - source node
node2 - destination node
Returns:
link array for links along these two nodes, null if no link exists

getLinkBetween

public Link getLinkBetween(Node node1,
                           Node node2)
gets link between two directly connected nodes

Returns:
direct link between two nodes, null if no link exists

calcBandwidth

public double calcBandwidth(double mss,
                            double rtt,
                            double p,
                            double c,
                            double delay)
calculate bandwidth through tcp formula

Returns:
calculated bandwidth