java.lang.Object
java.util.EventObject
org.bzdev.devqsim.SimulationStateEvent
- All Implemented Interfaces:
Serializable
Event indicating a change in the state of a simulation or one of
its objects.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The type of the simulation state event. -
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorsConstructorDescriptionSimulationStateEvent
(Object source, Simulation sim, Enum<?> type, Object origin, Object parameter) Constructor.SimulationStateEvent
(Object source, Simulation sim, Object server, Enum<?> type, Object origin, Object parameter) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionGet an event's origin.<T> T
Get an event's origin as a specific type.Get the event parameter.<T> T
getParameter
(Class<T> clazz) Get the event parameter, cast to a specific typeGet the server associated with an event.Get the simulation associated with the event.<T> T
Get the source of the event.<T extends Enum<T>>
TGet the type of the event.Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
SimulationStateEvent
public SimulationStateEvent(Object source, Simulation sim, Enum<?> type, Object origin, Object parameter) Constructor.- Parameters:
source
- the event sourcesim
- the simulationtype
- the type of the event.origin
- the object that originated the eventparameter
- an event parameter (usage depends on the type)
-
SimulationStateEvent
public SimulationStateEvent(Object source, Simulation sim, Object server, Enum<?> type, Object origin, Object parameter) Constructor.- Parameters:
source
- the event sourcesim
- the simulationserver
- the server (valid for a queue server)type
- the type of the event.origin
- the object that originated the eventparameter
- an event parameter (usage depends on the type)
-
-
Method Details
-
getSource
Get the source of the event. The source is the object that directly caused the event to be sent- Type Parameters:
T
- the type for the class specified by the argument- Parameters:
clazz
- the type that will be returned, which must match that for the source of this event- Returns:
- the source of the event
-
getType
Get the type of the event.- Type Parameters:
T
- the type for the class specified by the argument- Parameters:
clazz
- the class of the type, which must be an enum- Returns:
- the type of the event; null if the event does not have the specified type
-
getSimulation
Get the simulation associated with the event.- Returns:
- the simulation
-
getOrigin
Get an event's origin. The origin is an object that was responsible for the event being generated by the source. It's meaning depends on the type of event.- Returns:
- the origin
-
getOrigin
Get an event's origin as a specific type. The origin is an object that was responsible for the event being generated by the source. It's meaning depends on the type of event.- Type Parameters:
T
- the type for the class specified by the argument- Parameters:
clazz
- the class (or a superclass) of the origin- Returns:
- the origin
-
getParameter
Get the event parameter.- Returns:
- the parameter.
-
getServer
Get the server associated with an event. A server in this case is an object that implements a server used by a server queue in the simulation.- Returns:
- the server
-
getParameter
Get the event parameter, cast to a specific type- Type Parameters:
T
- the type for the class specified by the argument- Parameters:
clazz
- the class (or a superclass) of the parameter.- Returns:
- the parameter.
-