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
,ApplicationInteraction
,BatteryChargingStart
,BatteryChargingStop
,CellularCommunicationConfiguration
,CellularHandoverUpdates
,ChargingStationRegistration
,ChargingStationUpdate
,EnvironmentSensorActivation
,EnvironmentSensorUpdates
,GlobalEnvironmentUpdates
,InductionLoopDetectorSubscription
,ItefLogging
,LaneAreaDetectorSubscription
,LanePropertyChange
,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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected long
time
Simulation time at which the interaction happens in ns.
-
Constructor Summary
Constructors Modifier Constructor Description protected
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Interaction other)
static String
createTypeIdentifier(Class<? extends Interaction> interactionClass)
Helper method for creating type identifiers in a uniform way.boolean
equals(Object obj)
int
getId()
Returns the unique ID of this interaction.String
getSenderId()
Returns the ID of the sending federate.long
getTime()
Returns the simulation time at which the interaction happens in ns.String
getTypeId()
Returns the type identifier of the interaction.int
hashCode()
void
setSenderId(String senderId)
Assigns the specified ID of the sending federate to this interaction.String
toString()
-
-
-
Constructor Detail
-
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 Detail
-
getTime
public final long getTime()
Returns the simulation time at which the interaction happens in ns.- Returns:
- simulation time in nano-seconds
-
getTypeId
public String 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
public final String getSenderId()
Returns the ID of the sending federate.- Returns:
- the ID of the sending federate or
null
if none was assigned yet.
-
setSenderId
public final void setSenderId(@Nonnull String senderId) throws IllegalValueException
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.
-
compareTo
public int compareTo(Interaction other)
- Specified by:
compareTo
in interfaceComparable<Interaction>
-
createTypeIdentifier
public static String createTypeIdentifier(Class<? extends Interaction> interactionClass)
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
-
-