Class LambdaSimEvent<T extends Number & Comparable<T>>
java.lang.Object
nl.tudelft.simulation.dsol.formalisms.eventscheduling.AbstractSimEvent<T>
nl.tudelft.simulation.dsol.formalisms.eventscheduling.LambdaSimEvent<T>
- Type Parameters:
T
- the type of simulation time, e.g. Double, Long or Duration
- All Implemented Interfaces:
Serializable
,Comparable<SimEventInterface<T>>
,SimEventInterface<T>
The SimEvent forms the essential scheduling mechanism for D-SOL. Objects do not invoke methods directly on eachother; they
bundle the object on which the method is planned to be invoked together with the arguments and the name of the method in a
simEvent. The SimEvent is then stored in the eventList and executed.
Copyright (c) 2016-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Since:
- 1.5
- Author:
- Peter Jacobs
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Executable
executable is the lambda expression tghat takes care of the state change.Fields inherited from class nl.tudelft.simulation.dsol.formalisms.eventscheduling.AbstractSimEvent
absoluteExecutionTime, id, priority
Fields inherited from interface nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface
MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
Constructor Summary
ConstructorDescriptionLambdaSimEvent
(T executionTime, short priority, Executable executable) The constructor of the event stores the time the event must be executed and the object and method to invoke.LambdaSimEvent
(T executionTime, Executable executable) The constructor of the event stores the time the event must be executed and the object and method to invoke. -
Method Summary
Methods inherited from class nl.tudelft.simulation.dsol.formalisms.eventscheduling.AbstractSimEvent
getAbsoluteExecutionTime, getId, getPriority
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEventInterface
compareTo
-
Field Details
-
executable
executable is the lambda expression tghat takes care of the state change.
-
-
Constructor Details
-
LambdaSimEvent
The constructor of the event stores the time the event must be executed and the object and method to invoke.- Parameters:
executionTime
- T; the absolute time the event has to be executed.executable
- Executable; the lambda method to invoke
-
LambdaSimEvent
The constructor of the event stores the time the event must be executed and the object and method to invoke.- Parameters:
executionTime
- T; the time the event has to be executed.priority
- short; the priority of the eventexecutable
- Executable; the lambda method to invoke
-
-
Method Details
-
execute
Executes the simEvent.- Specified by:
execute
in interfaceSimEventInterface<T extends Number & Comparable<T>>
- Specified by:
execute
in classAbstractSimEvent<T extends Number & Comparable<T>>
- Throws:
SimRuntimeException
- on execution failure
-
toString
-