Class TrafficLightStateChange

java.lang.Object
org.eclipse.mosaic.rti.api.Interaction
org.eclipse.mosaic.interactions.traffic.TrafficLightStateChange
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Interaction>

public final class TrafficLightStateChange extends Interaction
This extension of Interaction is intended to be used to forward a request to change the state of a simulated traffic light.
See Also:
  • Field Details

    • TYPE_ID

      public static final String TYPE_ID
      String identifying the type of this interaction.
  • Constructor Details

    • TrafficLightStateChange

      public TrafficLightStateChange(long time, String trafficLightGroupId)
      Constructs TrafficLightStateChange>. The parameter type is initially ParamType.Undefined.
      Parameters:
      time - Timestamp of this interaction, unit: [ns]
      trafficLightGroupId - traffic light group identifier
  • Method Details

    • reset

      public void reset()
      Resets the pre-defined parameter type and the corresponding parameters. The parameter type of this TrafficLightStateChange changes to ParamType.Undefined.
    • setPhaseRemainingDuration

      public void setPhaseRemainingDuration(double remainingDuration)
      Sets the phase remaining duration. The parameter type of this TrafficLightStateChange changes to ParamType.RemainingDuration.
      Parameters:
      remainingDuration - new phase remaining duration in millisecond
    • setProgramId

      public void setProgramId(String programId)
      Sets id of the new traffic light program. The parameter type of this TrafficLightStateChange changes to ParamType.ProgramId.
      Parameters:
      programId - id of the new traffic light program
    • setPhaseIndex

      public void setPhaseIndex(int phaseIndex)
      Sets index of the new traffic light program phase. The parameter type of this TrafficLightStateChange changes to ParamType.ChangePhase.
      Parameters:
      phaseIndex - index of the new traffic light program phase
    • setProgramWithPhase

      public void setProgramWithPhase(String programId, int phaseId)
      Sets id of the new traffic light program and index of the new phase for the new program. The parameter type of this TrafficLightStateChange changes to ParamType.ChangeProgramWithPhase.
      Parameters:
      programId - index of the new traffic light program
    • setCustomState

      public void setCustomState(List<TrafficLightState> stateList)
      Sets a custom state which will be set for the traffic light.
      Parameters:
      stateList - the list of states for all traffic lights of the group
    • getTrafficLightGroupId

      public String getTrafficLightGroupId()
    • getParameterType

      public TrafficLightStateChange.ParamType getParameterType()
    • getPhaseRemainingDuration

      public double getPhaseRemainingDuration()
    • getProgramId

      public String getProgramId()
    • getPhaseIndex

      public int getPhaseIndex()
    • getCustomStateList

      public List<TrafficLightState> getCustomStateList()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Interaction
    • equals

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

      public String toString()
      Overrides:
      toString in class Interaction