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-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
12 * <p>
13 * @version $Revision$, $LastChangedDate$, by $Author$, initial version May 15, 2019 <br>
14 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
16 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
17 */
18 public abstract class AbstractHeadwayLaneBasedObject extends AbstractHeadwayCopy implements HeadwayLaneBasedObject
19 {
20
21 /** */
22 private static final long serialVersionUID = 20190515L;
23
24 /** Lane. */
25 private final Lane lane;
26
27 /**
28 * Construct a new Headway information object, for a non-moving object parallel with us.
29 * @param objectType ObjectType; the perceived object type, can be null if object type unknown.
30 * @param id String; the id of the object for comparison purposes, can not be null.
31 * @param overlapFront the front-front distance to the other object; if this constructor is used, this value cannot be null.
32 * @param overlap the 'center' overlap with the other object; if this constructor is used, this value cannot be null.
33 * @param overlapRear the rear-rear distance to the other object; if this constructor is used, this value cannot be null.
34 * @param length the length of the other object; if this constructor is used, length cannot be null.
35 * @param lane Lane; the lane.
36 * @throws GTUException when id is null, or parameters are inconsistent
37 */
38 public AbstractHeadwayLaneBasedObject(final ObjectType objectType, final String id, final Length overlapFront,
39 final Length overlap, final Length overlapRear, final Length length, final Lane lane) throws GTUException
40 {
41 super(objectType, id, overlapFront, overlap, overlapRear, length);
42 this.lane = lane;
43 }
44
45 /**
46 * Construct a new Headway information object, for a non-moving object parallel with us.
47 * @param objectType ObjectType; the perceived object type, can be null if object type unknown.
48 * @param id String; the id of the object for comparison purposes, can not be null.
49 * @param overlapFront the front-front distance to the other object; if this constructor is used, this value cannot be null.
50 * @param overlap the 'center' overlap with the other object; if this constructor is used, this value cannot be null.
51 * @param overlapRear the rear-rear distance to the other object; if this constructor is used, this value cannot be null.
52 * @param lane Lane; the lane.
53 * @throws GTUException when id is null, or parameters are inconsistent
54 */
55 public AbstractHeadwayLaneBasedObject(final ObjectType objectType, final String id, final Length overlapFront,
56 final Length overlap, final Length overlapRear, final Lane lane) throws GTUException
57 {
58 super(objectType, id, overlapFront, overlap, overlapRear);
59 this.lane = lane;
60 }
61
62 /**
63 * Construct a new Headway information object, for a non-moving object ahead of us or behind us.
64 * @param objectType ObjectType; the perceived object type, can be null if object type unknown.
65 * @param id String; the id of the object for comparison purposes, can not be null.
66 * @param distance the distance to the other object; if this constructor is used, distance cannot be null.
67 * @param length the length of the other object; if this constructor is used, length cannot be null.
68 * @param lane Lane; the lane.
69 * @throws GTUException when id is null, or parameters are inconsistent
70 */
71 public AbstractHeadwayLaneBasedObject(final ObjectType objectType, final String id, final Length distance,
72 final Length length, final Lane lane) throws GTUException
73 {
74 super(objectType, id, distance, length);
75 this.lane = lane;
76 }
77
78 /**
79 * Construct a new Headway information object, for a non-moving object ahead of us or behind us.
80 * @param objectType ObjectType; the perceived object type, can be null if object type unknown.
81 * @param id String; the id of the object for comparison purposes, can not be null.
82 * @param distance the distance to the other object; if this constructor is used, distance cannot be null.
83 * @param lane Lane; the lane.
84 * @throws GTUException when id is null, or parameters are inconsistent
85 */
86 public AbstractHeadwayLaneBasedObject(final ObjectType objectType, final String id, final Length distance, final Lane lane)
87 throws GTUException
88 {
89 super(objectType, id, distance);
90 this.lane = lane;
91 }
92
93 /** {@inheritDoc} */
94 @Override
95 public Lane getLane()
96 {
97 return this.lane;
98 }
99
100 }