1 package org.opentrafficsim.road.gtu.lane.perception.headway; 2 3 import org.djunits.value.vdouble.scalar.Length; 4 import org.opentrafficsim.core.gtu.GtuException; 5 import org.opentrafficsim.road.network.lane.Lane; 6 7 /** 8 * Lane based object headway with constructors for stationary information. 9 * <p> 10 * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 11 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 12 * </p> 13 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a> 14 * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a> 15 * @author <a href="https://github.com/wjschakel">Wouter Schakel</a> 16 */ 17 public abstract class AbstractHeadwayLaneBasedObject extends AbstractHeadwayCopy implements HeadwayLaneBasedObject 18 { 19 20 /** */ 21 private static final long serialVersionUID = 20190515L; 22 23 /** Lane. */ 24 private final Lane lane; 25 26 /** 27 * Construct a new Headway information object, for a non-moving object parallel with us. 28 * @param objectType ObjectType; the perceived object type, can be null if object type unknown. 29 * @param id String; the id of the object for comparison purposes, can not be null. 30 * @param overlapFront the front-front distance to the other object; if this constructor is used, this value cannot be null. 31 * @param overlap the 'center' overlap with the other object; if this constructor is used, this value cannot be null. 32 * @param overlapRear the rear-rear distance to the other object; if this constructor is used, this value cannot be null. 33 * @param length the length of the other object; if this constructor is used, length cannot be null. 34 * @param lane Lane; the lane. 35 * @throws GtuException when id is null, or parameters are inconsistent 36 */ 37 public AbstractHeadwayLaneBasedObject(final ObjectType objectType, final String id, final Length overlapFront, 38 final Length overlap, final Length overlapRear, final Length length, final Lane lane) throws GtuException 39 { 40 super(objectType, id, overlapFront, overlap, overlapRear, length); 41 this.lane = lane; 42 } 43 44 /** 45 * Construct a new Headway information object, for a non-moving object parallel with us. 46 * @param objectType ObjectType; the perceived object type, can be null if object type unknown. 47 * @param id String; the id of the object for comparison purposes, can not be null. 48 * @param overlapFront the front-front distance to the other object; if this constructor is used, this value cannot be null. 49 * @param overlap the 'center' overlap with the other object; if this constructor is used, this value cannot be null. 50 * @param overlapRear the rear-rear distance to the other object; if this constructor is used, this value cannot be null. 51 * @param lane Lane; the lane. 52 * @throws GtuException when id is null, or parameters are inconsistent 53 */ 54 public AbstractHeadwayLaneBasedObject(final ObjectType objectType, final String id, final Length overlapFront, 55 final Length overlap, final Length overlapRear, final Lane lane) throws GtuException 56 { 57 super(objectType, id, overlapFront, overlap, overlapRear); 58 this.lane = lane; 59 } 60 61 /** 62 * Construct a new Headway information object, for a non-moving object ahead of us or behind us. 63 * @param objectType ObjectType; the perceived object type, can be null if object type unknown. 64 * @param id String; the id of the object for comparison purposes, can not be null. 65 * @param distance the distance to the other object; if this constructor is used, distance cannot be null. 66 * @param length the length of the other object; if this constructor is used, length cannot be null. 67 * @param lane Lane; the lane. 68 * @throws GtuException when id is null, or parameters are inconsistent 69 */ 70 public AbstractHeadwayLaneBasedObject(final ObjectType objectType, final String id, final Length distance, 71 final Length length, final Lane lane) throws GtuException 72 { 73 super(objectType, id, distance, length); 74 this.lane = lane; 75 } 76 77 /** 78 * Construct a new Headway information object, for a non-moving object ahead of us or behind us. 79 * @param objectType ObjectType; the perceived object type, can be null if object type unknown. 80 * @param id String; the id of the object for comparison purposes, can not be null. 81 * @param distance the distance to the other object; if this constructor is used, distance cannot be null. 82 * @param lane Lane; the lane. 83 * @throws GtuException when id is null, or parameters are inconsistent 84 */ 85 public AbstractHeadwayLaneBasedObject(final ObjectType objectType, final String id, final Length distance, final Lane lane) 86 throws GtuException 87 { 88 super(objectType, id, distance); 89 this.lane = lane; 90 } 91 92 /** {@inheritDoc} */ 93 @Override 94 public Lane getLane() 95 { 96 return this.lane; 97 } 98 99 }