gps.network
Class BandwidthManager

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

public class BandwidthManager
extends java.lang.Object

bandwidth manager on each link

Version:
1.2, 6/20/2005
Author:
Weishuai Yang

Constructor Summary
BandwidthManager(Link l)
          constructor initiates a bandwidth on link
 
Method Summary
 void activeConnection(Connection c)
          active a existing connection on this link
 void addConnection(Connection c)
          add a connection on this link
 void adjustBandwidthForConnection(Connection c, double adj)
          adjucst bandwidth for a connection
 void bandwidthDraw(java.awt.Graphics g, int x, int y)
          draws bandwidth information on GUI component
 java.util.LinkedHashSet getActiveConnectionList()
          gets active connections on this link
 double getAvailableBandwidth()
          gets available bandwidth
 double getBandwidth()
          gets physical bandwidth
 java.util.LinkedHashSet getInActiveConnectionList()
          gets inactive connections on this link
 void inActiveConnection(Connection c)
          inactive a existing connection on this link
 double negotiateForConnection(Connection c)
          get estimated amount of bandwidth that can be allocated to a connection.
 void removeConnection(Connection c)
          remove a connection on this link
 void reserveFor(Connection c)
          reserve bandwidth for a connection
 void reset()
          reset to initial value
 void returnBandwidth(Connection c)
          return bandwidth occupied by connection to available bandwidth
 void setBandwidth(double i)
          sets physical bandwidth
 java.lang.String toString()
          gets string description
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BandwidthManager

public BandwidthManager(Link l)
constructor initiates a bandwidth on link

Parameters:
l - link
Method Detail

reset

public void reset()
reset to initial value


getBandwidth

public double getBandwidth()
gets physical bandwidth

Returns:
maximum bandwidth possible

setBandwidth

public void setBandwidth(double i)
sets physical bandwidth

Parameters:
i - maximum bandwidth possible

getAvailableBandwidth

public double getAvailableBandwidth()
gets available bandwidth

Returns:
available bandwidth

getActiveConnectionList

public java.util.LinkedHashSet getActiveConnectionList()
gets active connections on this link

Returns:
active connection list

getInActiveConnectionList

public java.util.LinkedHashSet getInActiveConnectionList()
gets inactive connections on this link

Returns:
inactive connection list

addConnection

public void addConnection(Connection c)
add a connection on this link

Parameters:
c - new connection

removeConnection

public void removeConnection(Connection c)
remove a connection on this link

Parameters:
c - connection to be removed

activeConnection

public void activeConnection(Connection c)
active a existing connection on this link

Parameters:
c - connection to be activated

inActiveConnection

public void inActiveConnection(Connection c)
inactive a existing connection on this link

Parameters:
c - connection to be inactivated

returnBandwidth

public void returnBandwidth(Connection c)
return bandwidth occupied by connection to available bandwidth

Parameters:
c - connection returning bandwidth

negotiateForConnection

public double negotiateForConnection(Connection c)
get estimated amount of bandwidth that can be allocated to a connection. After negotiation, this connection become inactive

Parameters:
c - connection that wants bandwidth

adjustBandwidthForConnection

public void adjustBandwidthForConnection(Connection c,
                                         double adj)
adjucst bandwidth for a connection

Parameters:
c - connection that needs adjust bandwidth
adj - adjust amount, positive for increase, and negative for decrease

reserveFor

public void reserveFor(Connection c)
reserve bandwidth for a connection

Parameters:
c - connection that needs reserve bandwidth

bandwidthDraw

public void bandwidthDraw(java.awt.Graphics g,
                          int x,
                          int y)
draws bandwidth information on GUI component

Parameters:
g - Graphics object
x - x position
y - y position

toString

public java.lang.String toString()
gets string description

Overrides:
toString in class java.lang.Object
Returns:
string description