📄 routingalgorithm.java
字号:
package dk.itu.nulx30.networkModel;
import dk.itu.nulx30.eventSimulation.EventSimulation;
import dk.itu.nulx30.networkModel.exceptions.NoPossibleRoutingException;
/**
* This is the interface for a routing algorithm. To be able to use a class as a
* routing algorithm in our simulation, the creator must implement this interface and
* use the class name in the simulation file.
*
* @author Mikkel Bundgaard
* @author Troels C. Damgaard
* @author Federico Decara
* @author Jacob W. Winther
*/
public interface RoutingAlgorithm {
/**
* This method takes a package and the router which currently holds the package
* and calculate the next router on the path to the destination. This method
* must always be implemented by subclasses otherwise will the routing not
* function.
*
* @param router the router which currently holds the package
* @param pack the pack to send to the destination router
*
* @exception NoPossibleRoutingException a
* <code>NoPossibleRoutingException</code> is thrown if it is not possible to
* route the package (it has reached a dead-end).
*
* @return the next router on the path to the destination
*/
public Router routePackage( Router router, NetworkPackage pack )
throws NoPossibleRoutingException;
/**
* This method can be used to put routing events into the event holder.
*
* @param sim the simulation in which the events has to occur
*/
public void scheduleRoutingEvents( EventSimulation sim );
/**
* This method is called from the simulation each time a package has arrived at
* its destination.
*
* @param netPackage the package which has arrived
*/
public void packageArrived( NetworkPackage netPackage );
/**
* This method is called when a router detecs that a package did not arrive
* at the router it was sent to. The routing algorithm gets a chance to update
* routing tables accordingly.
*
* @param netPackage the package which has died
*/
public void packageLost( NetworkPackage netPackage );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -