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

java.lang.Object
  extended by be.ac.ulg.montefiore.run.totem.trafficMatrix.model.impl.TrafficMatrixImpl
All Implemented Interfaces:
TrafficMatrix, java.lang.Iterable

public class TrafficMatrixImpl
extends java.lang.Object
implements TrafficMatrix

Implementation of the TrafficMatrix interface.

Creation date: 28-janv.-2005

Author:
Jean Lepropre (lepropre@run.montefiore.ulg.ac.be)

Nested Class Summary
 
Nested classes/interfaces inherited from interface be.ac.ulg.montefiore.run.totem.trafficMatrix.model.TrafficMatrix
TrafficMatrix.TrafficMatrixElem
 
Constructor Summary
TrafficMatrixImpl(Domain domain)
           
TrafficMatrixImpl(int asId)
          Creates a new TrafficMatrixImpl object.
 
Method Summary
 float get(int src, int dst)
          Returns the amount of traffic exchanged by the nodes src and dst.
 float get(java.lang.String src, java.lang.String dst)
          Returns the amount of traffic exchanged by the nodes src and dst.
 int getASID()
          Returns the AS ID of the traffic matrix.
 java.util.Calendar getDate()
          Get the date of matrix measurement
 double getDuration()
          Get the matrix measurement duration
 double[] getLinkLoad()
          Deprecated. Use class LinkLoadComputer instead.
 LinkLoadStrategy getLinkLoadStrategy()
          Deprecated. Use class LinkLoadComputer instead.
 double[] getLinkUtilisation()
          Deprecated. Use class LinkLoadComputer instead.
 TrafficMatrixChangeObserver getObserver()
          Get the change observer.
 int getTmId()
          Returns the id associated with the traffic matrix if it has already been set.
 BandwidthUnit getUnit()
          returns the unit used in the matrix representation
 boolean isSetTmId()
          Returns true if the id had been set
 java.util.Iterator<TrafficMatrix.TrafficMatrixElem> iterator()
          Returns an iterator over the elements in this traffic matrix.
 void set(int src, int dst, float value)
          Sets the amount of traffic exchanged by the nodes src and dst.
 void set(java.lang.String src, java.lang.String dst, float value)
          Sets the amount of traffic exchanged by the nodes src and dst.
 void setDate(java.util.Calendar date)
          Set the date of matrix measurement
 void setDuration(double duration)
          Set the matrix measurement duration
 void setLinkLoadStrategy(LinkLoadStrategy strategy)
          Deprecated. Use class LinkLoadComputer instead.
 void setTmId(int tmId)
          Associate an id with the matrix if it not already set.
 void setUnit(BandwidthUnit unit)
          A call to this function indicates the unit used in the matrix representation.
 float[] toOneDimensionalArray()
          Returns an array representing the matrix in one-dimensional form.
 float[][] toTwoDimensionalArray()
          Returns a float array representing the traffic matrix.
 void unsetTmId()
          Clear the Tm Id associated with the matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrafficMatrixImpl

public TrafficMatrixImpl(Domain domain)

TrafficMatrixImpl

public TrafficMatrixImpl(int asId)
                  throws InvalidDomainException
Creates a new TrafficMatrixImpl object.

Parameters:
asId - The AS ID of the traffic matrix.
Throws:
InvalidDomainException - If there is no domain with the AS ID asId.
Method Detail

getObserver

public TrafficMatrixChangeObserver getObserver()
Description copied from interface: TrafficMatrix
Get the change observer.

Specified by:
getObserver in interface TrafficMatrix
Returns:
the observer

getTmId

public int getTmId()
            throws TrafficMatrixIdException
Description copied from interface: TrafficMatrix
Returns the id associated with the traffic matrix if it has already been set.

Specified by:
getTmId in interface TrafficMatrix
Returns:
The traffic matrix Id
Throws:
TrafficMatrixIdException - if the id has not been set.

setTmId

public void setTmId(int tmId)
             throws TrafficMatrixIdException
Description copied from interface: TrafficMatrix
Associate an id with the matrix if it not already set. This method can be called only once without throwing an exception. Use TrafficMatrix.unsetTmId() to reset the tm id.

Specified by:
setTmId in interface TrafficMatrix
Throws:
TrafficMatrixIdException - if the id has already been set.

isSetTmId

public boolean isSetTmId()
Description copied from interface: TrafficMatrix
Returns true if the id had been set

Specified by:
isSetTmId in interface TrafficMatrix
Returns:

unsetTmId

public void unsetTmId()
Description copied from interface: TrafficMatrix
Clear the Tm Id associated with the matrix.

Specified by:
unsetTmId in interface TrafficMatrix

getASID

public int getASID()
Description copied from interface: TrafficMatrix
Returns the AS ID of the traffic matrix.

Specified by:
getASID in interface TrafficMatrix
Returns:
The AS ID of the traffic matrix.
See Also:
TrafficMatrix.getASID()

getUnit

public BandwidthUnit getUnit()
returns the unit used in the matrix representation

Specified by:
getUnit in interface TrafficMatrix
Returns:

setUnit

public void setUnit(BandwidthUnit unit)
A call to this function indicates the unit used in the matrix representation. Values are converted to correspond to the domain units. If unit is BandwidthUnit.DEFAULT_UNIT. The unit of the domain will be used (no conversion). This function can be called only if the unit has not already been set or with an argument equals to the unit already used. Otherwise an IllegalAccessError will be thrown.

Specified by:
setUnit in interface TrafficMatrix
Parameters:
unit -

getDate

public java.util.Calendar getDate()
Description copied from interface: TrafficMatrix
Get the date of matrix measurement

Specified by:
getDate in interface TrafficMatrix
Returns:
the date of matrix measurement

setDate

public void setDate(java.util.Calendar date)
Description copied from interface: TrafficMatrix
Set the date of matrix measurement

Specified by:
setDate in interface TrafficMatrix
Parameters:
date - the date of matrix measurement

getDuration

public double getDuration()
Description copied from interface: TrafficMatrix
Get the matrix measurement duration

Specified by:
getDuration in interface TrafficMatrix
Returns:
the matrix measurement duration

setDuration

public void setDuration(double duration)
Description copied from interface: TrafficMatrix
Set the matrix measurement duration

Specified by:
setDuration in interface TrafficMatrix
Parameters:
duration - the matrix measurement duration

iterator

public java.util.Iterator<TrafficMatrix.TrafficMatrixElem> iterator()
Description copied from interface: TrafficMatrix
Returns an iterator over the elements in this traffic matrix. The elements of the traffic matrix are returned row by row by the iterator. Note that the returned iterator doesn't support the remove operation.

Specified by:
iterator in interface TrafficMatrix
Specified by:
iterator in interface java.lang.Iterable
Returns:
An iterator over the elements in this traffic matrix.
See Also:
TrafficMatrix.iterator()

get

public float get(java.lang.String src,
                 java.lang.String dst)
          throws NodeNotFoundException
Description copied from interface: TrafficMatrix
Returns the amount of traffic exchanged by the nodes src and dst.

Specified by:
get in interface TrafficMatrix
Parameters:
src - The source node.
dst - The destination node.
Returns:
The amount of traffic exchanged by the nodes src and dst.
Throws:
NodeNotFoundException - If there is no node src or no node dst.
See Also:
TrafficMatrix.get(java.lang.String, java.lang.String)

get

public float get(int src,
                 int dst)
          throws NodeNotFoundException
Description copied from interface: TrafficMatrix
Returns the amount of traffic exchanged by the nodes src and dst.

Specified by:
get in interface TrafficMatrix
Parameters:
src - The source node.
dst - The destination node.
Returns:
The amount of traffic exchanged by the nodes src and dst.
Throws:
NodeNotFoundException - If there is no node src or no node dst.
See Also:
TrafficMatrix.get(int, int)

set

public void set(java.lang.String src,
                java.lang.String dst,
                float value)
         throws NodeNotFoundException
Description copied from interface: TrafficMatrix
Sets the amount of traffic exchanged by the nodes src and dst.

Specified by:
set in interface TrafficMatrix
Parameters:
src - The source node.
dst - The destination node.
value - The amount of traffic.
Throws:
NodeNotFoundException - If there is no node src or no node dst.
See Also:
TrafficMatrix.set(java.lang.String, java.lang.String, float)

set

public void set(int src,
                int dst,
                float value)
         throws NodeNotFoundException
Description copied from interface: TrafficMatrix
Sets the amount of traffic exchanged by the nodes src and dst.

Specified by:
set in interface TrafficMatrix
Parameters:
src - The source node.
dst - The destination node.
value - The amount of traffic.
Throws:
NodeNotFoundException - If there is no node src or no node dst.
See Also:
TrafficMatrix.set(int, int, float)

toOneDimensionalArray

public float[] toOneDimensionalArray()
Returns an array representing the matrix in one-dimensional form. The value associated with the pair (srcId, dstId) is at index domain.getConvertor.getNodeId(srcId)*domain.getConvertor.getMaxNodeId()+domain.getConvertor.getNodeId(dstId) in the resulting array.

Specified by:
toOneDimensionalArray in interface TrafficMatrix
Returns:

toTwoDimensionalArray

public float[][] toTwoDimensionalArray()
Returns a float array representing the traffic matrix. The value associated with the pair (srcId, dstId) is at index [domain.getConvertor.getNodeId(srcId)][domain.getConvertor.getNodeId(dstId)].

Specified by:
toTwoDimensionalArray in interface TrafficMatrix
Returns:

setLinkLoadStrategy

public void setLinkLoadStrategy(LinkLoadStrategy strategy)
Deprecated. Use class LinkLoadComputer instead.

Set the strategy of link load computation. This strategy is used to compute link load and link utilisation.

Specified by:
setLinkLoadStrategy in interface TrafficMatrix
Parameters:
strategy - the link load computation strategy

getLinkLoadStrategy

public LinkLoadStrategy getLinkLoadStrategy()
Deprecated. Use class LinkLoadComputer instead.

Get the link load computation strategy

Specified by:
getLinkLoadStrategy in interface TrafficMatrix
Returns:
the link load computation strategy

getLinkLoad

public double[] getLinkLoad()
                     throws NoRouteToHostException,
                            RoutingException
Deprecated. Use class LinkLoadComputer instead.

Returns the link loads computed by the LinkLoadStrategy.

The link load is defined by the total amound of traffic on the link express in bandwidth unit.

Let ret be the returned array. ret[i] is the load of the link InterDomainManager.getInstance().getDomain(this.getASID()).getConvertor().getLinkId(i).

Specified by:
getLinkLoad in interface TrafficMatrix
Returns:
the link loads computed by the LinkLoadStrategy.
Throws:
NoRouteToHostException - If there is no route between a pair of nodes.
RoutingException - if an error occurred during the routing process.

getLinkUtilisation

public double[] getLinkUtilisation()
                            throws NoRouteToHostException,
                                   RoutingException
Deprecated. Use class LinkLoadComputer instead.

Returns the link utilisations computed by the LinkLoadStrategy. The link utilisation is defined by the link load divided by the link capacity express in percentage. Let ret be the returned array. ret[i] is the utilisation of the link InterDomainManager.getInstance().getDomain(this.getASID()).getConvertor().getLinkId(i).

Specified by:
getLinkUtilisation in interface TrafficMatrix
Returns:
the link utilisations if we route the traffic using a SPF algorithm.
Throws:
NoRouteToHostException - if there is no route between a pair of nodes.
RoutingException - if an error occurred during the routing process.


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