core_lib
Class BWidthUnit

java.lang.Object
  extended by core_lib.BWidthUnit

public class BWidthUnit
extends java.lang.Object

The BWidthUnit class helps manage bandwidth at the user level. It consists of a queue of type integer. The number of entries in that queue represents the number of occupied connections, saturating at GLOBALS.BAND_MAX. The queue entry value indicates at which cycle that connection can be freed.


Field Summary
private  Globals GLOBALS
          Parameters of the Network in which this BWidthUnit resides.
private  java.util.Queue<java.lang.Integer> queue
          Cycle number at which each connection can be freed.
 
Constructor Summary
BWidthUnit(Globals GLOBALS)
          Construct a BWidthUnit object.
 
Method Summary
 boolean available(int cycle)
          Query to see if this BWidthUnit has available bandwidth.
 void consume(int cycle)
          Consume a connection for the next GLOBALS.BAND+PER cycles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBALS

private Globals GLOBALS
Parameters of the Network in which this BWidthUnit resides.


queue

private java.util.Queue<java.lang.Integer> queue
Cycle number at which each connection can be freed.

Constructor Detail

BWidthUnit

public BWidthUnit(Globals GLOBALS)
Construct a BWidthUnit object.

Parameters:
GLOBALS - The Network parameterization object
Method Detail

available

public boolean available(int cycle)
Query to see if this BWidthUnit has available bandwidth.

Parameters:
cycle - The cycle at which this query is being made
Returns:
TRUE if bandwidth is available; FALSE otherwise

consume

public void consume(int cycle)
Consume a connection for the next GLOBALS.BAND+PER cycles

Parameters:
cycle - The cycle at which this connection begins.