AnyLogic
Expand
Font size
All Implemented Interfaces:
ISignalable, Serializable

public class RoadLanesConnector
extends Object
implements 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

ConstructorDescription
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, List<MarkupSegment> guideLine) 

Method Summary

Modifier and TypeMethodDescription
intcountCars()
Returns total number of cars passed through the connector
RoadgetEndRoad()
Returns the road this connector ends at
intgetEndRoadLane()
Returns the lane number on the road this connector ends at
List<MarkupSegment>getGuideLine()
Returns the guide line, in the form of segments list
TrafficLightSignalgetSignal()
Returns current signal of road lanes connector
RoadgetStartRoad()
Returns the road this connector starts at
intgetStartRoadLane()
Returns the lane number on the road this connector starts at
voidregisterListener(SignalChangeListener stateChangeListener)
Allows to register a CarSettings instance as a listener of signal change events
voidresetStats()
Resets total cars counter
voidsetDataSource(RoadLaneConnectorDataSource dataSource) 
voidsetSignal(TrafficLightSignal signal)
Changes the current signal.
StringtoString() 
inttraffic()
Returns the traffic of car flow through the connector, measured in cars per hour.

Methods inherited from class java.lang.Object

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

Constructor Details

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,
 List<MarkupSegment> guideLine)

Method Details

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 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:

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 String toString()
Overrides:
toString in class Object