Class SimEvent<T extends Number & Comparable<T>>
java.lang.Object
nl.tudelft.simulation.dsol.formalisms.eventscheduling.AbstractSimEvent<T>
nl.tudelft.simulation.dsol.formalisms.eventscheduling.SimEvent<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) 2002-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 Object[]
args are the arguments that are used to invoke the method with.protected String
method is the method which embodies the state change.protected Object
target the target on which a state change is scheduled.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
ConstructorDescriptionThe constructor of the event stores the time the event must be executed and the object and method to invoke.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
-
target
target the target on which a state change is scheduled. -
methodName
method is the method which embodies the state change. -
args
args are the arguments that are used to invoke the method with.
-
-
Constructor Details
-
SimEvent
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.target
- Object; the object on which the method must be invoked.method
- String; the method to invokeargs
- Object[]; the arguments the method to invoke with
-
SimEvent
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 eventtarget
- Object; the object on which the method must be invoked.method
- String; the method to invokeargs
- Object[]; the arguments the method to invoke with
-
-
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
-
getArgs
- Returns:
- Returns the args.
-
getMethod
- Returns:
- Returns the method.
-
getTarget
- Returns:
- Returns the target.
-
printTarget
Retrieve the target in a human readable way.- Returns:
- String; the target in a human readable way
-
printArgs
Retrieve the arguments in a human readable way.- Returns:
- String; the arguments in a human readable way
-
toString
-