1 package org.opentrafficsim.road.gtu.lane.tactical.lmrs;
2
3 import java.util.LinkedHashSet;
4
5 import org.djutils.immutablecollections.Immutable;
6 import org.djutils.immutablecollections.ImmutableLinkedHashSet;
7 import org.djutils.immutablecollections.ImmutableSet;
8 import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;
9 import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
10 import org.opentrafficsim.road.gtu.lane.tactical.AbstractLaneBasedTacticalPlanner;
11 import org.opentrafficsim.road.gtu.lane.tactical.following.CarFollowingModel;
12 import org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.MandatoryIncentive;
13 import org.opentrafficsim.road.gtu.lane.tactical.util.lmrs.VoluntaryIncentive;
14
15
16
17
18
19
20
21
22
23
24 public abstract class AbstractIncentivesTacticalPlanner extends AbstractLaneBasedTacticalPlanner
25 {
26
27
28 private final LinkedHashSet<MandatoryIncentive> mandatoryIncentives = new LinkedHashSet<>();
29
30
31 private final LinkedHashSet<VoluntaryIncentive> voluntaryIncentives = new LinkedHashSet<>();
32
33
34 private final LinkedHashSet<AccelerationIncentive> accelerationIncentives = new LinkedHashSet<>();
35
36
37 private final ImmutableSet<MandatoryIncentive> immutableMandatoryIncentives =
38 new ImmutableLinkedHashSet<>(this.mandatoryIncentives, Immutable.WRAP);
39
40
41 private final ImmutableSet<VoluntaryIncentive> immutableVoluntaryIncentives =
42 new ImmutableLinkedHashSet<>(this.voluntaryIncentives, Immutable.WRAP);
43
44
45 private final ImmutableSet<AccelerationIncentive> immutableAccelerationIncentives =
46 new ImmutableLinkedHashSet<>(this.accelerationIncentives, Immutable.WRAP);
47
48
49
50
51
52
53
54 public AbstractIncentivesTacticalPlanner(final CarFollowingModel carFollowingModel, final LaneBasedGtu gtu,
55 final LanePerception lanePerception)
56 {
57 super(carFollowingModel, gtu, lanePerception);
58 }
59
60
61
62
63
64 public final void addMandatoryIncentive(final MandatoryIncentive incentive)
65 {
66 if (incentive != null)
67 {
68 this.mandatoryIncentives.add(incentive);
69 }
70 }
71
72
73
74
75
76 public final void addVoluntaryIncentive(final VoluntaryIncentive incentive)
77 {
78 if (incentive != null)
79 {
80 this.voluntaryIncentives.add(incentive);
81 }
82 }
83
84
85
86
87
88 public final void addAccelerationIncentive(final AccelerationIncentive incentive)
89 {
90 if (incentive != null)
91 {
92 this.accelerationIncentives.add(incentive);
93 }
94 }
95
96
97
98
99
100 public final ImmutableSet<MandatoryIncentive> getMandatoryIncentives()
101 {
102 return this.immutableMandatoryIncentives;
103 }
104
105
106
107
108
109 public final ImmutableSet<VoluntaryIncentive> getVoluntaryIncentives()
110 {
111 return this.immutableVoluntaryIncentives;
112 }
113
114
115
116
117
118 public final ImmutableSet<AccelerationIncentive> getAccelerationIncentives()
119 {
120 return this.immutableAccelerationIncentives;
121 }
122
123 }