public abstract class IEventProcessor
extends com.net2plan.internal.sim.ISimExternal
Abstract class that must be inherited so that an event processor can be executed
inside the Online network simulation
tool included within Net2Plan
.
Constructor and Description |
---|
IEventProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
endSimulation()
Throws an 'end of simulation' exception, so that the kernel finishes
immediately the simulation, and it triggers the
finish() method. |
void |
endTransitory()
Indicates to the kernel that the transitory should be finished after
processing the current event, triggering the
finishTransitory() method of both event
generator and processor. |
String |
finish(StringBuilder output,
double simTime)
Returns an algorithm-specific report.
|
void |
finishTransitory(double simTime)
Performs some transitory-finished action.
|
abstract String |
getDescription()
Returns the description.
|
abstract List<Triple<String,String,String>> |
getParameters()
Returns the list of required parameters, where the first item of each element
is the parameter name, the second one is the parameter value, and the third
one is the parameter description.
|
abstract void |
initialize(NetPlan initialNetPlan,
Map<String,String> algorithmParameters,
Map<String,String> simulationParameters,
Map<String,String> net2planParameters)
Initializes the algorithm (i.e.
|
abstract void |
processEvent(NetPlan currentNetPlan,
SimEvent event)
Processes the next event in the future event list.
|
void |
scheduleEvent(SimEvent event)
Adds a new event to the future event list.
|
public final void endSimulation()
Throws an 'end of simulation' exception, so that the kernel finishes
immediately the simulation, and it triggers the
finish()
method.
Important: Please, do not catch this exception inside your code.
endSimulation
in class com.net2plan.internal.sim.ISimExternal
public final void endTransitory()
Indicates to the kernel that the transitory should be finished after
processing the current event, triggering the
finishTransitory()
method of both event
generator and processor.
If the transitory finished previously, this will have no effect.
endTransitory
in class com.net2plan.internal.sim.ISimExternal
public String finish(StringBuilder output, double simTime)
finish
in class com.net2plan.internal.sim.ISimExternal
output
- Container for the reportsimTime
- Current simulation timenull
, or an empty output
to omit it)public void finishTransitory(double simTime)
finishTransitory
in class com.net2plan.internal.sim.ISimExternal
simTime
- Current timepublic abstract String getDescription()
getDescription
in interface com.net2plan.internal.IExternal
getDescription
in class com.net2plan.internal.sim.ISimExternal
public abstract List<Triple<String,String,String>> getParameters()
Returns the list of required parameters, where the first item of each element is the parameter name, the second one is the parameter value, and the third one is the parameter description.
It is possible to define type-specific parameters if the default value is set according to the following rules (but user is responsible of checking in its own code):
.class
or .jar
file where the code is located, the class name,
and a set of parameters (pair of key-values separated by commas, where individual
key and value are separated with an equal symbol. The same applies to reports (#report#),
event generators (#eventGenerator#) and event processors (#eventProcessor#).getParameters
in interface com.net2plan.internal.IExternal
getParameters
in class com.net2plan.internal.sim.ISimExternal
public abstract void initialize(NetPlan initialNetPlan, Map<String,String> algorithmParameters, Map<String,String> simulationParameters, Map<String,String> net2planParameters)
initialize
in class com.net2plan.internal.sim.ISimExternal
initialNetPlan
- Initial network planalgorithmParameters
- A key-value map with specific algorithm parameters.simulationParameters
- A key-value map with simulation parametersnet2planParameters
- A key-value map with Net2Plan
-wide configuration optionspublic abstract void processEvent(NetPlan currentNetPlan, SimEvent event)
scheduleEvent
method.processEvent
in class com.net2plan.internal.sim.ISimExternal
currentNetPlan
- Current network planevent
- Current event to be processedpublic final void scheduleEvent(SimEvent event)
Adds a new event to the future event list.
scheduleEvent
in class com.net2plan.internal.sim.ISimExternal
event
- Event to be scheduledCopyright © 2018. All rights reserved.