public abstract class IEventProcessor
extends 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,
NetPlan currentNetPlan,
Map<String,String> algorithmParameters,
Map<String,String> simulationParameters,
Map<String,String> net2planParameters)
Initializes the algorithm (i.e. reading input parameters).
|
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.
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.
public String finish(StringBuilder output, double simTime)
output
- Container for the reportsimTime
- Current simulation timenull
, or an empty output
to omit it)public void finishTransitory(double simTime)
simTime
- Current timepublic abstract String getDescription()
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#).public abstract void initialize(NetPlan initialNetPlan, NetPlan currentNetPlan, Map<String,String> algorithmParameters, Map<String,String> simulationParameters, Map<String,String> net2planParameters)
initialNetPlan
- Initial network plancurrentNetPlan
- Current 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.currentNetPlan
- Current network planevent
- Current event to be processedpublic final void scheduleEvent(SimEvent event)
Adds a new event to the future event list.
event
- Event to be scheduled