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 ofInteraction
is intended to be used to forward a request to change the state of a simulated traffic light.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TrafficLightStateChange.ParamType
Identifies which kind of parameter type is used in this TrafficLightStateChange.
-
Field Summary
Fields Modifier and Type Field Description static String
TYPE_ID
String identifying the type of this interaction.-
Fields inherited from class org.eclipse.mosaic.rti.api.Interaction
time
-
-
Constructor Summary
Constructors Constructor Description TrafficLightStateChange(long time, String trafficLightGroupId)
ConstructsTrafficLightStateChange
>.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
List<TrafficLightState>
getCustomStateList()
TrafficLightStateChange.ParamType
getParameterType()
int
getPhaseIndex()
double
getPhaseRemainingDuration()
String
getProgramId()
String
getTrafficLightGroupId()
int
hashCode()
void
reset()
Resets the pre-defined parameter type and the corresponding parameters.void
setCustomState(List<TrafficLightState> stateList)
Sets a custom state which will be set for the traffic light.void
setPhaseIndex(int phaseIndex)
Sets index of the new traffic light program phase.void
setPhaseRemainingDuration(double remainingDuration)
Sets the phase remaining duration.void
setProgramId(String programId)
Sets id of the new traffic light program.void
setProgramWithPhase(String programId, int phaseId)
Sets id of the new traffic light program and index of the new phase for the new program.String
toString()
-
Methods inherited from class org.eclipse.mosaic.rti.api.Interaction
compareTo, createTypeIdentifier, getId, getSenderId, getTime, getTypeId, setSenderId
-
-
-
-
Field Detail
-
TYPE_ID
public static final String TYPE_ID
String identifying the type of this interaction.
-
-
Constructor Detail
-
TrafficLightStateChange
public TrafficLightStateChange(long time, String trafficLightGroupId)
ConstructsTrafficLightStateChange
>. The parameter type is initiallyParamType.Undefined
.- Parameters:
time
- Timestamp of this interaction, unit: [ns]trafficLightGroupId
- traffic light group identifier
-
-
Method Detail
-
reset
public void reset()
Resets the pre-defined parameter type and the corresponding parameters. The parameter type of thisTrafficLightStateChange
changes toParamType.Undefined
.
-
setPhaseRemainingDuration
public void setPhaseRemainingDuration(double remainingDuration)
Sets the phase remaining duration. The parameter type of thisTrafficLightStateChange
changes toParamType.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 thisTrafficLightStateChange
changes toParamType.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 thisTrafficLightStateChange
changes toParamType.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 thisTrafficLightStateChange
changes toParamType.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 classInteraction
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classInteraction
-
toString
public String toString()
- Overrides:
toString
in classInteraction
-
-