Class HeadwayConflict
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadway
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayCopy
org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayLaneBasedObject
org.opentrafficsim.road.gtu.lane.perception.headway.HeadwayConflict
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Headway>
,Identifiable
,PerceivedObject
,Headway
,HeadwayLaneBasedObject
public class HeadwayConflict extends AbstractHeadwayLaneBasedObject
Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version Jun 2, 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HeadwayConflict.Width
Width progression of conflict.Nested classes/interfaces inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.Headway
Headway.ObjectType
-
Constructor Summary
Constructors Constructor Description HeadwayConflict(ConflictType conflictType, ConflictPriority conflictPriority, java.lang.Class<? extends ConflictRule> conflictRuleType, java.lang.String id, Length distance, Length length, Length conflictingLength, PerceptionCollectable<HeadwayGTU,LaneBasedGTU> upstreamConflictingGTUs, PerceptionCollectable<HeadwayGTU,LaneBasedGTU> downstreamConflictingGTUs, Length conflictingVisibility, Speed conflictingSpeedLimit, CrossSectionLink conflictingLink, HeadwayConflict.Width width, HeadwayStopLine stopLine, HeadwayStopLine conflictingStopLine, Lane lane)
Constructor.HeadwayConflict(ConflictType conflictType, ConflictPriority conflictPriority, java.lang.Class<? extends ConflictRule> conflictRuleType, java.lang.String id, Length distance, Length length, Length conflictingLength, PerceptionCollectable<HeadwayGTU,LaneBasedGTU> upstreamConflictingGTUs, PerceptionCollectable<HeadwayGTU,LaneBasedGTU> downstreamConflictingGTUs, Length conflictingVisibility, Speed conflictingSpeedLimit, CrossSectionLink conflictingLink, HeadwayConflict.Width width, Lane lane)
Constructor without stop lines. -
Method Summary
Modifier and Type Method Description Length
getConflictingLength()
Returns the length of the conflict on the conflicting lane.CrossSectionLink
getConflictingLink()
Returns the conflicting link.Speed
getConflictingSpeedLimit()
Returns the speed limit on the conflicting lane.HeadwayStopLine
getConflictingStopLine()
Returns the stop line on the conflicting lane.Length
getConflictingTrafficLightDistance()
Returns the distance of a traffic light upstream on the conflicting lane.Length
getConflictingVisibility()
Returns the visibility on the conflicting lane within which conflicting vehicles are visible.ConflictPriority
getConflictPriority()
Returns the conflict priority.java.lang.Class<? extends ConflictRule>
getConflictRuleType()
Returns the conflict rule type.ConflictType
getConflictType()
Returns the conflict type.PerceptionCollectable<HeadwayGTU,LaneBasedGTU>
getDownstreamConflictingGTUs()
Returns a set of conflicting GTU's downstream of the start of the conflict ordered close to far from the conflict.HeadwayStopLine
getStopLine()
Returns the stop line.PerceptionCollectable<HeadwayGTU,LaneBasedGTU>
getUpstreamConflictingGTUs()
Returns a set of conflicting GTU's upstream of the start of the conflict ordered close to far from the conflict.Length
getWidthAtFraction(double fraction)
Returns the width at the given fraction.boolean
isCrossing()
Returns whether this is a crossing conflict.boolean
isMerge()
Returns whether this is a merge conflict.boolean
isPermitted()
Whether the conflict is permitted by the traffic light.boolean
isSplit()
Returns whether this is a split conflict.void
setConflictingTrafficLight(Length trafficLightDistance, boolean permittedConflict)
Set the distance of a traffic light upstream on the conflicting lane.java.lang.String
toString()
Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayLaneBasedObject
getLane
Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadwayCopy
equals, getAcceleration, getId, getLength, getObjectType, getSpeed, hashCode
Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.headway.AbstractHeadway
getDistance, getOverlap, getOverlapFront, getOverlapRear, isAhead, isBehind, isParallel
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opentrafficsim.road.gtu.lane.perception.headway.Headway
compareTo, getAcceleration, getDistance, getId, getLength, getObjectType, getOverlap, getOverlapFront, getOverlapRear, getSpeed, isAhead, isBehind, isParallel
-
Constructor Details
-
HeadwayConflict
public HeadwayConflict(ConflictType conflictType, ConflictPriority conflictPriority, java.lang.Class<? extends ConflictRule> conflictRuleType, java.lang.String id, Length distance, Length length, Length conflictingLength, PerceptionCollectable<HeadwayGTU,LaneBasedGTU> upstreamConflictingGTUs, PerceptionCollectable<HeadwayGTU,LaneBasedGTU> downstreamConflictingGTUs, Length conflictingVisibility, Speed conflictingSpeedLimit, CrossSectionLink conflictingLink, HeadwayConflict.Width width, HeadwayStopLine stopLine, HeadwayStopLine conflictingStopLine, Lane lane) throws GTUExceptionConstructor.- Parameters:
conflictType
- ConflictType; conflict typeconflictPriority
- ConflictPriority; conflict priorityconflictRuleType
- Class<? extends ConflictRule>; conflict rule typeid
- String; iddistance
- Length; distancelength
- Length; length of the conflictconflictingLength
- Length; length of the conflict on the conflicting laneupstreamConflictingGTUs
- PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; conflicting GTU's upstream of the <i>start</i> of the conflictdownstreamConflictingGTUs
- PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; conflicting GTU's downstream of the <i>start</i> of the conflictconflictingVisibility
- Length; visibility on the conflicting lane within which conflicting vehicles are visibleconflictingSpeedLimit
- Speed; speed limit on the conflicting laneconflictingLink
- CrossSectionLink; conflicting linkwidth
- Width; width progression of conflictstopLine
- HeadwayStopLine; stop line on the own laneconflictingStopLine
- HeadwayStopLine; stop line on the conflicting lanelane
- Lane; the lane- Throws:
GTUException
- when id is null, or parameters are inconsistent
-
HeadwayConflict
public HeadwayConflict(ConflictType conflictType, ConflictPriority conflictPriority, java.lang.Class<? extends ConflictRule> conflictRuleType, java.lang.String id, Length distance, Length length, Length conflictingLength, PerceptionCollectable<HeadwayGTU,LaneBasedGTU> upstreamConflictingGTUs, PerceptionCollectable<HeadwayGTU,LaneBasedGTU> downstreamConflictingGTUs, Length conflictingVisibility, Speed conflictingSpeedLimit, CrossSectionLink conflictingLink, HeadwayConflict.Width width, Lane lane) throws GTUExceptionConstructor without stop lines.- Parameters:
conflictType
- ConflictType; conflict typeconflictPriority
- ConflictPriority; conflict priorityconflictRuleType
- Class<? extends ConflictRule>; conflict rule typeid
- String; iddistance
- Length; distancelength
- Length; length of the conflictconflictingLength
- Length; length of the conflict on the conflicting laneupstreamConflictingGTUs
- PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; conflicting GTU's upstream of the <i>start</i> of the conflictdownstreamConflictingGTUs
- PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; conflicting GTU's downstream of the <i>start</i> of the conflictconflictingVisibility
- Length; visibility on the conflicting lane within which conflicting vehicles are visibleconflictingSpeedLimit
- Speed; speed limit on the conflicting laneconflictingLink
- CrossSectionLink; conflicting linkwidth
- Width; width progression of conflictlane
- Lane; the lane- Throws:
GTUException
- when id is null, or parameters are inconsistent
-
-
Method Details
-
getConflictType
Returns the conflict type.- Returns:
- conflict type
-
isCrossing
public final boolean isCrossing()Returns whether this is a crossing conflict.- Returns:
- whether this is a crossing conflict
-
isMerge
public final boolean isMerge()Returns whether this is a merge conflict.- Returns:
- whether this is a merge conflict
-
isSplit
public final boolean isSplit()Returns whether this is a split conflict.- Returns:
- whether this is a split conflict
-
getConflictPriority
Returns the conflict priority.- Returns:
- conflict priority
-
getConflictingLength
Returns the length of the conflict on the conflicting lane.- Returns:
- length of the conflict on the conflicting lane
-
getUpstreamConflictingGTUs
Returns a set of conflicting GTU's upstream of the start of the conflict ordered close to far from the conflict.- Returns:
- set of conflicting GTU's upstream of the start of the conflict ordered close to far from the conflict
-
getDownstreamConflictingGTUs
Returns a set of conflicting GTU's downstream of the start of the conflict ordered close to far from the conflict. Distance is given relative to the end of the conflict, or null for conflicting vehicles on the conflict. In the latter case the overlap is used.- Returns:
- set of conflicting GTU's downstream of the start of the conflict ordered close to far from the conflict
-
getConflictingVisibility
Returns the visibility on the conflicting lane within which conflicting vehicles are visible. All upstream conflicting GTUs have a distance smaller than the visibility. Depending on a limited visibility, a certain (lower) speed may be required while approaching the conflict.- Returns:
- visibility on the conflicting lane within which conflicting vehicles are visible
-
getConflictingSpeedLimit
Returns the speed limit on the conflicting lane.- Returns:
- speed limit on the conflicting lane
-
getConflictingLink
Returns the conflicting link.- Returns:
- the conflicting link
-
getStopLine
Returns the stop line.- Returns:
- stop line
-
getConflictingStopLine
Returns the stop line on the conflicting lane.- Returns:
- stop line
-
getConflictRuleType
Returns the conflict rule type.- Returns:
- conflict rule type
-
getConflictingTrafficLightDistance
Returns the distance of a traffic light upstream on the conflicting lane.- Returns:
- distance of a traffic light upstream on the conflicting lane, or
null
if no traffic light
-
isPermitted
public final boolean isPermitted()Whether the conflict is permitted by the traffic light.- Returns:
- whether the conflict is permitted by the traffic light
-
setConflictingTrafficLight
public final void setConflictingTrafficLight(Length trafficLightDistance, boolean permittedConflict)Set the distance of a traffic light upstream on the conflicting lane.- Parameters:
trafficLightDistance
- Length; distance of a traffic light upstream on the conflicting lane.permittedConflict
- boolean; whether the conflict is permitted by the traffic light
-
getWidthAtFraction
Returns the width at the given fraction.- Parameters:
fraction
- double; fraction from 0 to 1- Returns:
- Length; width at the given fraction
-
toString
public final java.lang.String toString()- Overrides:
toString
in classAbstractHeadway
-