Class FixedTimeController.SignalGroup

    • Constructor Detail

      • SignalGroup

        public SignalGroup​(java.lang.String id,
                           java.util.Set<java.lang.String> trafficLightIds,
                           Duration offset,
                           Duration green,
                           Duration yellow)
        Constructor without pre-green duration.
        Parameters:
        id - String; id
        trafficLightIds - Set<String>; traffic light ids
        offset - Duration; offset from start of cycle
        green - Duration; green duration
        yellow - Duration; yellow duration
      • SignalGroup

        public SignalGroup​(java.lang.String id,
                           java.util.Set<java.lang.String> trafficLightIds,
                           Duration offset,
                           Duration preGreen,
                           Duration green,
                           Duration yellow)
        Constructor with pre-green duration.
        Parameters:
        id - String; id
        trafficLightIds - Set<String>; traffic light ids
        offset - Duration; offset from start of cycle
        preGreen - Duration; pre-green duration
        green - Duration; green duration
        yellow - Duration; yellow duration
    • Method Detail

      • getId

        public java.lang.String getId()
        Retrieve the id of this signal group.
        Specified by:
        getId in interface Identifiable
        Returns:
        String
      • startup

        public void startup​(Duration controllerOffset,
                            Duration cycleTime,
                            OTSSimulatorInterface theSimulator,
                            Network network)
                     throws SimRuntimeException
        Connect to the traffic lights in the network, initialize the traffic lights to their initial color and schedule the first transitions.
        Parameters:
        controllerOffset - Duration;
        cycleTime - Duration;
        theSimulator - OTSSimulatorInterface;
        network - Network;
        Throws:
        SimRuntimeException - when traffic light does not exist in the network
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getRed

        public final Duration getRed()
        Returns:
        red.
      • getTrafficLightIds

        public final ImmutableSet<java.lang.String> getTrafficLightIds()
        Returns:
        trafficLightIds.
      • getOffset

        public final Duration getOffset()
        Returns:
        offset.
      • getPreGreen

        public final Duration getPreGreen()
        Returns:
        preGreen.
      • getGreen

        public final Duration getGreen()
        Returns:
        green.
      • getYellow

        public final Duration getYellow()
        Returns:
        yellow.
      • getCurrentColor

        public TrafficLightColor getCurrentColor()
        Retrieve the current color of this SignalGroup.
        Returns:
        TrafficLightColor; the current color of this signal group.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object