Package org.eclipse.mosaic.rti.api
Class Interaction
java.lang.Object
org.eclipse.mosaic.rti.api.Interaction
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Interaction>
- Direct Known Subclasses:
AdHocCommunicationConfiguration
,AgentRegistration
,AgentRemoval
,AgentRouteChange
,AgentUpdates
,ApplicationInteraction
,BatteryChargingStart
,BatteryChargingStop
,CellularCommunicationConfiguration
,CellularHandoverUpdates
,ChargingStationRegistration
,ChargingStationUpdate
,EnvironmentSensorActivation
,EnvironmentSensorUpdates
,GlobalEnvironmentUpdates
,InductionLoopDetectorSubscription
,ItefLogging
,LaneAreaDetectorSubscription
,LanePropertyChange
,LidarUpdates
,RsuRegistration
,ScenarioTrafficLightRegistration
,ScenarioVehicleRegistration
,ServerRegistration
,SumoTraciRequest
,SumoTraciResponse
,TmcRegistration
,TrafficDetectorUpdates
,TrafficLightRegistration
,TrafficLightStateChange
,TrafficLightSubscription
,TrafficLightUpdates
,TrafficSignLaneAssignmentChange
,TrafficSignRegistration
,TrafficSignSpeedLimitChange
,V2xMessageAcknowledgement
,V2xMessageReception
,V2xMessageRemoval
,V2xMessageTransmission
,VehicleBatteryUpdates
,VehicleChargingDenial
,VehicleChargingStartRequest
,VehicleChargingStopRequest
,VehicleFederateAssignment
,VehicleLaneChange
,VehicleParametersChange
,VehicleRegistration
,VehicleResume
,VehicleRouteChange
,VehicleRouteRegistration
,VehicleRoutesInitialization
,VehicleSeenTrafficSignsUpdate
,VehicleSensorActivation
,VehicleSightDistanceConfiguration
,VehicleSlowDown
,VehicleSpeedChange
,VehicleStop
,VehicleTypesInitialization
,VehicleUpdates
public abstract class Interaction
extends Object
implements Comparable<Interaction>, Cloneable, Serializable
This abstract class MUST be the parent class of all interactions that shall be
exchanged between federates.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final long
Simulation time at which the interaction happens in ns. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Interaction
(long time) Constructor using fields.protected
Interaction
(long time, int id) Creates a new interaction with the specified time and predetermined id. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(Interaction other) static String
createTypeIdentifier
(Class<? extends Interaction> interactionClass) Helper method for creating type identifiers in a uniform way.boolean
final int
getId()
Returns the unique ID of this interaction.final String
Returns the ID of the sending federate.final long
getTime()
Returns the simulation time at which the interaction happens in ns.Returns the type identifier of the interaction.int
hashCode()
final void
setSenderId
(String senderId) Assigns the specified ID of the sending federate to this interaction.toString()
-
Field Details
-
time
protected final long timeSimulation time at which the interaction happens in ns.
-
-
Constructor Details
-
Interaction
protected Interaction(long time) Constructor using fields.- Parameters:
time
- Simulation time at which the interaction happens.
-
Interaction
protected Interaction(long time, int id) Creates a new interaction with the specified time and predetermined id. Except for special cases the constructorInteraction(long)
should be used instead.- Parameters:
time
- the simulation time (in ns) at which the interaction happens.id
- the predetermined id.
-
-
Method Details
-
getTime
public final long getTime()Returns the simulation time at which the interaction happens in ns.- Returns:
- simulation time in nano-seconds
-
getTypeId
Returns the type identifier of the interaction.- Returns:
- the type identifier.
-
getId
public final int getId()Returns the unique ID of this interaction.- Returns:
- the unique ID of this interaction.
-
getSenderId
Returns the ID of the sending federate.- Returns:
- the ID of the sending federate or
null
if none was assigned yet.
-
setSenderId
Assigns the specified ID of the sending federate to this interaction. This method is called by theRtiAmbassador
and should not be called somewhere else.- Parameters:
senderId
- the ID of the sending federate to set.- Throws:
IllegalValueException
- if the sender ID was already assigned.
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<Interaction>
-
toString
-
createTypeIdentifier
Helper method for creating type identifiers in a uniform way.- Parameters:
interactionClass
- the class extending fromInteraction
- Returns:
- the type identifier based on the
Interaction
class
-