be.ac.ulg.montefiore.run.totem.visualtopo.graph
Class MyWidthCalculator

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.domain.model.DomainChangeAdapter
      extended by be.ac.ulg.montefiore.run.totem.visualtopo.graph.MyWidthCalculator
All Implemented Interfaces:
DomainChangeListener, WidthCalculator

public class MyWidthCalculator
extends DomainChangeAdapter
implements WidthCalculator

Calculate the width of a link given its bandwidth.

The width is calculated relative to the minimum and maximum link capacity in the network. The returned width is between 1 and 6 pixel. The class listens to domain changes (add link, remove link, bandwidth change) and adapt the width accordingly.
The virtual links are not taken into account.

Creation date: 29/05/2007

Author:
Gaƫl Monfort (monfort@run.montefiore.ulg.ac.be)

Field Summary
 int MAX_WIDTH
           
 int MIN_WIDTH
           
 
Constructor Summary
MyWidthCalculator(Domain domain)
           
 
Method Summary
 void addLinkEvent(Link link)
          Notify a add link event
 int getWidth(float bwValue)
          Returns the link width to display given the bandwidth of the link.
 void linkBandwidthChangeEvent(Link link)
          Notify a link bandwidth change event
 void removeLinkEvent(Link link)
          Notify a remove link event
 void stop()
           
 
Methods inherited from class be.ac.ulg.montefiore.run.totem.domain.model.DomainChangeAdapter
addLspEvent, addNodeEvent, linkDelayChangeEvent, linkMetricChangeEvent, linkReservedBandwidthChangeEvent, linkStatusChangeEvent, linkTeMetricChangeEvent, lspReservationChangeEvent, lspWorkingPathChangeEvent, nodeLocationChangeEvent, nodeStatusChangeEvent, removeLspEvent, removeNodeEvent, rerouteLspEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_WIDTH

public final int MIN_WIDTH
See Also:
Constant Field Values

MAX_WIDTH

public final int MAX_WIDTH
See Also:
Constant Field Values
Constructor Detail

MyWidthCalculator

public MyWidthCalculator(Domain domain)
Method Detail

getWidth

public int getWidth(float bwValue)
Description copied from interface: WidthCalculator
Returns the link width to display given the bandwidth of the link.

Specified by:
getWidth in interface WidthCalculator
Returns:

stop

public void stop()

addLinkEvent

public void addLinkEvent(Link link)
Description copied from class: DomainChangeAdapter
Notify a add link event

Specified by:
addLinkEvent in interface DomainChangeListener
Overrides:
addLinkEvent in class DomainChangeAdapter

removeLinkEvent

public void removeLinkEvent(Link link)
Description copied from class: DomainChangeAdapter
Notify a remove link event

Specified by:
removeLinkEvent in interface DomainChangeListener
Overrides:
removeLinkEvent in class DomainChangeAdapter

linkBandwidthChangeEvent

public void linkBandwidthChangeEvent(Link link)
Description copied from class: DomainChangeAdapter
Notify a link bandwidth change event

Specified by:
linkBandwidthChangeEvent in interface DomainChangeListener
Overrides:
linkBandwidthChangeEvent in class DomainChangeAdapter


Copyright © 2004-2007 Research Unit in Networking, All Rights Reserved.