|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.ac.ulg.montefiore.run.totem.topgen.util.RoutingMatrix
public abstract class RoutingMatrix
This is the base class for the routing matrix classes.
The matrix is a float matrix, so you can route packets from A to B with two different paths. As a routing matrix is generally a large sparse matrix, we represent it by means of a doubly linked structure.
The rows of the matrix designate the links of the topology and the columns designate the pairs of nodes of the topology.
Creation date: 2004
Constructor Summary | |
---|---|
RoutingMatrix()
|
Method Summary | |
---|---|
protected void |
add(float value,
int link,
int src,
int dst)
Like set but adds value to the current
contained value. |
IntFloatPair[] |
getColumn(int src,
int dst)
Returns the non-null elements of the column corresponding to ( src ,dst ). |
float |
getElement(int link,
int src,
int dst)
Returns the value for the pair ( src ,dst ) and
the link link . |
IntPair |
getIds(int column)
Returns the ids of the pair of nodes corresponding to the column column . |
int |
getKey(int src,
int dst)
Returns the column corresponding to the pair ( src ,dst ). |
int |
getNbColumns()
Returns the number of columns of this routing matrix. |
int |
getNbRows()
Returns the number of rows of this routing matrix. |
IntFloatPair[] |
getRow(int link)
Returns the non-null elements of the row corresponding to link . |
abstract void |
recompute()
Recomputes the routing matrix. |
protected void |
set(float value,
int link,
int src,
int dst)
This method sets the element corresponding to link ,
src and dst to value . |
protected void |
setSize(int nbRows,
int nbCols)
Sets the size of the matrix. |
java.lang.String |
toString()
Returns a string representing the matrix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RoutingMatrix()
Method Detail |
---|
public final int getKey(int src, int dst)
src
,dst
).
java.lang.IllegalArgumentException
- If src
is equal to dst
.public final IntPair getIds(int column)
column
. The first int
is the source node id
and the second int
is the destination node id.
java.lang.IllegalArgumentException
- If column
has a bad value.public abstract void recompute() throws RoutingException, NoRouteToHostException
RoutingException
NoRouteToHostException
public final float getElement(int link, int src, int dst)
src
,dst
) and
the link link
.
java.lang.IllegalArgumentException
- If link
, src
and/or dst
have a bad value.public final IntFloatPair[] getRow(int link)
link
. If there is no non-null element in the row
link
, it returns null
. The int
values of the IntFloatPair
objects designate the indexes
of the non-null elements and the float
values of the
IntFloatPair
objects designate the values of the elements.
java.lang.IllegalArgumentException
- If link
has a bad value.public final IntFloatPair[] getColumn(int src, int dst)
src
,dst
). If there is no
non-null element, it returns null
. The int
values of the IntFloatPair
objects designate the indexes
of the non-null elements and the float
values of the
IntFloatPair
objects designate the values of the elements.
java.lang.IllegalArgumentException
- If src
and/or dst
have a bad value.public final int getNbRows()
public final int getNbColumns()
protected final void add(float value, int link, int src, int dst)
set
but adds value
to the current
contained value.
protected final void set(float value, int link, int src, int dst)
link
,
src
and dst
to value
.
The subclasses should call this method to set the elements of the
matrix.
java.lang.IllegalArgumentException
- If link
, src
and/or dst
have a bad
value.protected final void setSize(int nbRows, int nbCols)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |