All Implemented Interfaces:
Serializable, Comparable<Headway>, org.djutils.base.Identifiable, PerceivedObject, Headway, HeadwayLaneBasedObject

public class HeadwayConflict extends AbstractHeadwayLaneBasedObject

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
See Also:
  • Constructor Details

    • HeadwayConflict

      public HeadwayConflict(ConflictType conflictType, ConflictPriority conflictPriority, Class<? extends ConflictRule> conflictRuleType, String id, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length conflictingLength, PerceptionCollectable<HeadwayGtu,LaneBasedGtu> upstreamConflictingGTUs, PerceptionCollectable<HeadwayGtu,LaneBasedGtu> downstreamConflictingGTUs, org.djunits.value.vdouble.scalar.Length conflictingVisibility, org.djunits.value.vdouble.scalar.Speed conflictingSpeedLimit, CrossSectionLink conflictingLink, HeadwayConflict.Width width, HeadwayStopLine stopLine, HeadwayStopLine conflictingStopLine, Lane lane) throws GtuException
      Constructor.
      Parameters:
      conflictType - ConflictType; conflict type
      conflictPriority - ConflictPriority; conflict priority
      conflictRuleType - Class<? extends ConflictRule>; conflict rule type
      id - String; id
      distance - Length; distance
      length - Length; length of the conflict
      conflictingLength - Length; length of the conflict on the conflicting lane
      upstreamConflictingGTUs - PerceptionCollectable<HeadwayGtu,LaneBasedGtu>; conflicting GTU's upstream of the <i>start</i> of the conflict
      downstreamConflictingGTUs - PerceptionCollectable<HeadwayGtu,LaneBasedGtu>; conflicting GTU's downstream of the <i>start</i> of the conflict
      conflictingVisibility - Length; visibility on the conflicting lane within which conflicting vehicles are visible
      conflictingSpeedLimit - Speed; speed limit on the conflicting lane
      conflictingLink - CrossSectionLink; conflicting link
      width - Width; width progression of conflict
      stopLine - HeadwayStopLine; stop line on the own lane
      conflictingStopLine - HeadwayStopLine; stop line on the conflicting lane
      lane - Lane; the lane
      Throws:
      GtuException - when id is null, or parameters are inconsistent
    • HeadwayConflict

      public HeadwayConflict(ConflictType conflictType, ConflictPriority conflictPriority, Class<? extends ConflictRule> conflictRuleType, String id, org.djunits.value.vdouble.scalar.Length distance, org.djunits.value.vdouble.scalar.Length length, org.djunits.value.vdouble.scalar.Length conflictingLength, PerceptionCollectable<HeadwayGtu,LaneBasedGtu> upstreamConflictingGTUs, PerceptionCollectable<HeadwayGtu,LaneBasedGtu> downstreamConflictingGTUs, org.djunits.value.vdouble.scalar.Length conflictingVisibility, org.djunits.value.vdouble.scalar.Speed conflictingSpeedLimit, CrossSectionLink conflictingLink, HeadwayConflict.Width width, Lane lane) throws GtuException
      Constructor without stop lines.
      Parameters:
      conflictType - ConflictType; conflict type
      conflictPriority - ConflictPriority; conflict priority
      conflictRuleType - Class<? extends ConflictRule>; conflict rule type
      id - String; id
      distance - Length; distance
      length - Length; length of the conflict
      conflictingLength - Length; length of the conflict on the conflicting lane
      upstreamConflictingGTUs - PerceptionCollectable<HeadwayGtu,LaneBasedGtu>; conflicting GTU's upstream of the <i>start</i> of the conflict
      downstreamConflictingGTUs - PerceptionCollectable<HeadwayGtu,LaneBasedGtu>; conflicting GTU's downstream of the <i>start</i> of the conflict
      conflictingVisibility - Length; visibility on the conflicting lane within which conflicting vehicles are visible
      conflictingSpeedLimit - Speed; speed limit on the conflicting lane
      conflictingLink - CrossSectionLink; conflicting link
      width - Width; width progression of conflict
      lane - Lane; the lane
      Throws:
      GtuException - when id is null, or parameters are inconsistent
  • Method Details

    • getConflictType

      public final ConflictType 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

      public final ConflictPriority getConflictPriority()
      Returns the conflict priority.
      Returns:
      conflict priority
    • getConflictingLength

      public final org.djunits.value.vdouble.scalar.Length getConflictingLength()
      Returns the length of the conflict on the conflicting lane.
      Returns:
      length of the conflict on the conflicting lane
    • getUpstreamConflictingGTUs

      public final 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.
      Returns:
      set of conflicting GTU's upstream of the start of the conflict ordered close to far from the conflict
    • getDownstreamConflictingGTUs

      public final 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. 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

      public final org.djunits.value.vdouble.scalar.Length 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

      public final org.djunits.value.vdouble.scalar.Speed getConflictingSpeedLimit()
      Returns the speed limit on the conflicting lane.
      Returns:
      speed limit on the conflicting lane
    • getConflictingLink

      public final CrossSectionLink getConflictingLink()
      Returns the conflicting link.
      Returns:
      the conflicting link
    • getStopLine

      public final HeadwayStopLine getStopLine()
      Returns the stop line.
      Returns:
      stop line
    • getConflictingStopLine

      public final HeadwayStopLine getConflictingStopLine()
      Returns the stop line on the conflicting lane.
      Returns:
      stop line
    • getConflictRuleType

      public final Class<? extends ConflictRule> getConflictRuleType()
      Returns the conflict rule type.
      Returns:
      conflict rule type
    • getConflictingTrafficLightDistance

      public final org.djunits.value.vdouble.scalar.Length 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(org.djunits.value.vdouble.scalar.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

      public final org.djunits.value.vdouble.scalar.Length getWidthAtFraction(double fraction)
      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 String toString()
      Overrides:
      toString in class AbstractHeadway