|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbcds.phison.ra.RoutingAlgBase<V,E>
public class RoutingAlgBase<V,E>
Provides default implementation of the methods defined
in RoutingAlg
as well as additional methods
useful for routing algorithms.
Constructor Summary | |
---|---|
RoutingAlgBase()
|
Method Summary | |
---|---|
Path<V,E> |
buildPathFromParentNodes(SimGraph<V,E> g,
V dest,
java.util.Map<V,V> parent)
Builds a Path object from
the "parent" structure produced
by routing algorithms such as Dijkstra's. |
void |
commitBackupPath(ConnectionInfo<V,E> cnx)
Does nothing. |
void |
commitWorkingPath(ConnectionInfo<V,E> cnx)
Calls ted.updateResidualCap() to decrease the available
capacity on the links included in cnx.wrk_path . |
void |
dumpState()
Prints (to stdout) the environment, followed by the residual capacity and cost of each link, as reported by the TED object. |
Path<V,E> |
getBackupPath()
Throws UnsupportedOperationException to indicate that protection
is not implemented. |
double |
getCost(E e)
Returns the cost of link e, which in this implementation is simply the cost registered in the TED's cost map. |
Environ |
getEnviron()
Returns a reference to the environment object. |
java.lang.Object[] |
getEnvParams()
Returns an zero-length, empty array, suitable for routing algorithms that do not need addtional environment parameters. |
java.lang.String |
getName()
Returns the "short" class name (without any package name). |
TED<V,E> |
getTED()
Returns a reference to the TED object. |
Path<V,E> |
getWorkingPath()
Returns a reference to the object returned by the last call to run() . |
boolean |
offersProtection()
Returns false. |
void |
setBackupPath(Path<V,E> path)
Sets the backup path. |
void |
setRequest(V src,
V dest,
int rq_cap)
Saves for future use the source, destination and requested capacity. |
void |
setup(TED<V,E> ted,
Environ env)
Saves a copy of the reference to the TED object and to the environment object. |
void |
setWorkingPath(Path<V,E> path)
Sets the working path. |
void |
topologyHasChanged()
Does nothing. |
void |
uncommitBackupPath(ConnectionInfo<V,E> cnx)
Does nothing. |
void |
uncommitWorkingPath(ConnectionInfo<V,E> cnx)
Performs the opposite actions of commitWorkingPath(bcds.phison.ra.ConnectionInfo . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RoutingAlgBase()
Method Detail |
---|
public void setup(TED<V,E> ted, Environ env)
TED
object and to the environment object.
If env
is null, a new Environ
is created. If env.getStr("args")
is non-null,
the key-value pairs
in there are inserted into the environment, and the key "args"
is finally removed
(see Environ.fromArgsString(String)
for a description of the key-values pairs format).
If a given key already exists in env
,
it is left unchanged, that is, "args" does not override the keys
in env
.
Finally, getEnvParams()
is called, either to insert any default parameter missing in
the environment, or to check (and adapt if possible) each
value's type.
java.lang.IllegalArgumentException
- if there is an uncorrectable
type mismatch
between the environment values and the default values.public boolean offersProtection()
public double getCost(E e)
public void commitWorkingPath(ConnectionInfo<V,E> cnx)
ted.updateResidualCap()
to decrease the available
capacity on the links included in cnx.wrk_path
.
public void uncommitWorkingPath(ConnectionInfo<V,E> cnx)
commitWorkingPath(bcds.phison.ra.ConnectionInfo)
.
public void commitBackupPath(ConnectionInfo<V,E> cnx)
public void uncommitBackupPath(ConnectionInfo<V,E> cnx)
public TED<V,E> getTED()
public Environ getEnviron()
public java.lang.String getName()
public void setRequest(V src, V dest, int rq_cap)
public Path<V,E> getWorkingPath()
run()
. Note that it can be null.
public Path<V,E> getBackupPath()
UnsupportedOperationException
to indicate that protection
is not implemented.
public void setWorkingPath(Path<V,E> path)
public void setBackupPath(Path<V,E> path)
public Path<V,E> buildPathFromParentNodes(SimGraph<V,E> g, V dest, java.util.Map<V,V> parent)
Path
object from
the "parent" structure produced
by routing algorithms such as Dijkstra's. The path
returned is from the current src
(see setRequest(V, V, int)
)
up to the parameter dest
. Further details on
the "parent" map can be found in the class DijkstraAll
.
IllegalArtumentException
- if the path includes loops or
if it has "holes" that prevents reaching the source.public java.lang.Object[] getEnvParams()
public void topologyHasChanged()
public void dumpState()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |