AnyLogic
Expand
Font size
  • java.lang.Object
    • com.anylogic.engine.markup.RoadLanesConnector
All Implemented Interfaces:
ISignalable, java.io.Serializable

public class RoadLanesConnector
extends java.lang.Object
implements java.io.Serializable, ISignalable
Road lanes connector inside an intersection. Connects one lane of road incoming to the intersection with one lane of the outgoing road.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Constructor Summary

Constructors 
RoadLanesConnector​(Road startRoad, int startRoadLane, Road endRoad, int endRoadLane)  
RoadLanesConnector​(Road startRoad, int startRoadLane, Road endRoad, int endRoadLane, MarkupSegment... guideLine)  
RoadLanesConnector​(Road startRoad, int startRoadLane, Road endRoad, int endRoadLane, java.util.List<MarkupSegment> guideLine)  
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods 
int countCars()
Returns total number of cars passed through the connector
Road getEndRoad()
Returns the road this connector ends at
int getEndRoadLane()
Returns the lane number on the road this connector ends at
java.util.List<MarkupSegment> getGuideLine()
Returns the guide line, in the form of segments list
TrafficLightSignal getSignal()
Returns current signal of road lanes connector
Road getStartRoad()
Returns the road this connector starts at
int getStartRoadLane()
Returns the lane number on the road this connector starts at
void registerListener​(SignalChangeListener stateChangeListener)
Allows to register a CarSettings instance as a listener of signal change events
void resetStats()
Resets total cars counter
void setDataSource​(RoadLaneConnectorDataSource dataSource)  
void setSignal​(TrafficLightSignal signal)
Changes the current signal.
java.lang.String toString()  
int traffic()
Returns the traffic of car flow through the connector, measured in cars per hour.
Modifier and Type Method Description

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

RoadLanesConnector

public RoadLanesConnector​(Road startRoad,
                          int startRoadLane,
                          Road endRoad,
                          int endRoadLane)

RoadLanesConnector

public RoadLanesConnector​(Road startRoad,
                          int startRoadLane,
                          Road endRoad,
                          int endRoadLane,
                          MarkupSegment... guideLine)

RoadLanesConnector

public RoadLanesConnector​(Road startRoad,
                          int startRoadLane,
                          Road endRoad,
                          int endRoadLane,
                          java.util.List<MarkupSegment> guideLine)

Method Detail

getStartRoad

public Road getStartRoad()
Returns the road this connector starts at
Returns:
the reference to road this connector starts at

getStartRoadLane

public int getStartRoadLane()
Returns the lane number on the road this connector starts at
Returns:
lane number, where 0 is lane at the road side

getEndRoad

public Road getEndRoad()
Returns the road this connector ends at
Returns:
the reference to road this connector ends at

getEndRoadLane

public int getEndRoadLane()
Returns the lane number on the road this connector ends at
Returns:
lane number, where 0 is lane at the road side

getGuideLine

public java.util.List<MarkupSegment> getGuideLine()
Returns the guide line, in the form of segments list
Returns:
list of segments

setSignal

public void setSignal​(TrafficLightSignal signal)
Changes the current signal. Use when road lanes connector isn't controlled by traffic light.
Specified by:
setSignal in interface ISignalable
Parameters:
signal - New signal

getSignal

public TrafficLightSignal getSignal()
Returns current signal of road lanes connector
Specified by:
getSignal in interface ISignalable
Returns:
Current signal of road lanes connector

traffic

public int traffic()
Returns the traffic of car flow through the connector, measured in cars per hour.
Note: the value calculated for last five-minute interval
Returns:
the traffic from one specified road to another specified road, cars per hour

countCars

public int countCars()
Returns total number of cars passed through the connector
Returns:
total number of cars passed through the connector
See Also:
#resetCarsCounter()

resetStats

public void resetStats()
Resets total cars counter
See Also:
countCars()

setDataSource

@AnyLogicInternalAPI
public void setDataSource​(RoadLaneConnectorDataSource dataSource)

registerListener

@AnyLogicInternalAPI
public void registerListener​(SignalChangeListener stateChangeListener)
Allows to register a CarSettings instance as a listener of signal change events
Specified by:
registerListener in interface ISignalable
Parameters:
listener - Add instance of SignalChangeListener interface that will listen to the event.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
How can we improve this article?