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

    Fields
    Modifier and Type
    Field
    Description
    protected final long
    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

    Modifier and Type
    Method
    Description
    int
     
    static String
    createTypeIdentifier(Class<? extends Interaction> interactionClass)
    Helper method for creating type identifiers in a uniform way.
    boolean
     
    final int
    Returns the unique ID of this interaction.
    final String
    Returns the ID of the sending federate.
    final long
    Returns the simulation time at which the interaction happens in ns.
    Returns the type identifier of the interaction.
    int
     
    final void
    setSenderId(String senderId)
    Assigns the specified ID of the sending federate to this interaction.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • time

      protected final long time
      Simulation 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 constructor Interaction(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

      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 the RtiAmbassador 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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(Interaction other)
      Specified by:
      compareTo in interface Comparable<Interaction>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createTypeIdentifier

      public static String createTypeIdentifier(Class<? extends Interaction> interactionClass)
      Helper method for creating type identifiers in a uniform way.
      Parameters:
      interactionClass - the class extending from Interaction
      Returns:
      the type identifier based on the Interaction class