be.ac.ulg.montefiore.run.totem.trafficMatrix.model.impl
Class AbstractLinkLoadComputer

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.trafficMatrix.model.impl.AbstractLinkLoadComputer
All Implemented Interfaces:
LinkLoadComputer
Direct Known Subclasses:
AbstractLinkLoadStrategy, MultiCommodityFlow, OptDivideTMLoadComputer, PureMPLSCosLinkLoadComputer

public abstract class AbstractLinkLoadComputer
extends java.lang.Object
implements LinkLoadComputer

Provide default implementation for some functionnalities of the LinkLoadComputer.

Creation date: 28/01/2008

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

Field Summary
protected  LinkLoadComputerInvalidator changeListener
          The object that listens to events and invalidate the LinkLoadComputer
protected  Domain domain
          The associated domain
 
Constructor Summary
protected AbstractLinkLoadComputer(Domain domain)
          Creates a new LinkLoadComputer with the default change listener (LinkLoadComputerInvalidator.
protected AbstractLinkLoadComputer(Domain domain, LinkLoadComputerInvalidator changeListener)
          Creates a new LinkLoadComputer with the given change listener.
 
Method Summary
 void addListener(LinkLoadComputerListener listener)
          Add a listener.
protected  void dataChanged()
          Call this method when data has been recomputed, signals a change in the data.
 void destroy()
          Destroy the linkLoadComputer: remove all listeners, invalidate the data and stop listening to events.
 Domain getDomain()
          Returns the domain associated.
 void invalidate()
          Mark the data as outdated and signals the listeners if the validity has changed.
 boolean isUpToDate()
          Returns true if the internal data are up-to-date
 void removeListener(LinkLoadComputerListener listener)
          Remove a listener.
protected  void setUptoDate(boolean upToDate)
          If the data validity has changed, also signals the listeners.
 void startListening()
          add the change listener to the domain, and to the currently used traffic matrices
 void stopListening()
          Remove the listener from the domain and from the currently used traffic matrices
 void update()
          Call LinkLoadComputer.recompute() if the data is not up-to-date, else do nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface be.ac.ulg.montefiore.run.totem.trafficMatrix.model.LinkLoadComputer
detachData, equals, getData, getShortName, getTrafficMatrices, hashCode, recompute
 

Field Detail

domain

protected Domain domain
The associated domain


changeListener

protected LinkLoadComputerInvalidator changeListener
The object that listens to events and invalidate the LinkLoadComputer

Constructor Detail

AbstractLinkLoadComputer

protected AbstractLinkLoadComputer(Domain domain)
Creates a new LinkLoadComputer with the default change listener (LinkLoadComputerInvalidator.

Parameters:
domain -

AbstractLinkLoadComputer

protected AbstractLinkLoadComputer(Domain domain,
                                   LinkLoadComputerInvalidator changeListener)
Creates a new LinkLoadComputer with the given change listener.

Parameters:
domain -
changeListener -
Method Detail

addListener

public void addListener(LinkLoadComputerListener listener)
Add a listener. Once added, the listener will be notified of changes in the validity of the LinkLoadComputer.

Specified by:
addListener in interface LinkLoadComputer
Parameters:
listener -

removeListener

public void removeListener(LinkLoadComputerListener listener)
Remove a listener.

Specified by:
removeListener in interface LinkLoadComputer
Parameters:
listener -

destroy

public void destroy()
Destroy the linkLoadComputer: remove all listeners, invalidate the data and stop listening to events.

Specified by:
destroy in interface LinkLoadComputer

startListening

public void startListening()
add the change listener to the domain, and to the currently used traffic matrices

Specified by:
startListening in interface LinkLoadComputer

stopListening

public void stopListening()
Remove the listener from the domain and from the currently used traffic matrices

Specified by:
stopListening in interface LinkLoadComputer

update

public void update()
Call LinkLoadComputer.recompute() if the data is not up-to-date, else do nothing.

Specified by:
update in interface LinkLoadComputer

dataChanged

protected void dataChanged()
Call this method when data has been recomputed, signals a change in the data.


getDomain

public Domain getDomain()
Description copied from interface: LinkLoadComputer
Returns the domain associated.

Specified by:
getDomain in interface LinkLoadComputer
Returns:

isUpToDate

public boolean isUpToDate()
Description copied from interface: LinkLoadComputer
Returns true if the internal data are up-to-date

Specified by:
isUpToDate in interface LinkLoadComputer
Returns:

setUptoDate

protected void setUptoDate(boolean upToDate)
If the data validity has changed, also signals the listeners.

Parameters:
upToDate -

invalidate

public void invalidate()
Mark the data as outdated and signals the listeners if the validity has changed.

Specified by:
invalidate in interface LinkLoadComputer


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