View Javadoc
1   package org.opentrafficsim.core.gtu.following;
2   
3   import org.opentrafficsim.core.unit.AccelerationUnit;
4   import org.opentrafficsim.core.unit.TimeUnit;
5   import org.opentrafficsim.core.value.vdouble.scalar.DoubleScalar;
6   
7   /**
8    * Container for two instances of an AccelerationStep.
9    * <p>
10   * Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights
11   * reserved. <br>
12   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
13   * <p>
14   * @version 11 mrt. 2015 <br>
15   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
16   */
17  public class DualAccelerationStep
18  {
19      /** AccelerationStep for the leader. */
20      private final AccelerationStep leaderAccelerationStep;
21  
22      /** AccelerationStep for the (new) follower. */
23      private final AccelerationStep followerAccelerationStep;
24  
25      /**
26       * Create a new DualAccelerationStep.
27       * @param leaderAccelerationStep AccelerationStep; the acceleration and time step size for the leader
28       * @param followerAccelerationStep AccelerationStep; the acceleration and time step size for the (new) follower
29       */
30      public DualAccelerationStep(final AccelerationStep leaderAccelerationStep,
31              final AccelerationStep followerAccelerationStep)
32      {
33          this.leaderAccelerationStep = leaderAccelerationStep;
34          this.followerAccelerationStep = followerAccelerationStep;
35      }
36      
37      /**
38       * Retrieve the AccelerationStep for the leader GTU.
39       * @return AccelerationStep; the acceleration and time step size for the leader
40       */
41      public final AccelerationStep getLeaderAccelerationStep()
42      {
43          return this.leaderAccelerationStep;
44      }
45      
46      /**
47       * Retrieve the AccelerationStep for the (new) follower GTU.
48       * @return AccelerationStep; the acceleration and time step size for the (new) follower
49       */
50      public final AccelerationStep getFollowerAccelerationStep()
51      {
52          return this.followerAccelerationStep;
53      }
54      
55      /**
56       * Return the acceleration of the leader.
57       * @return DoubleScalar&lt;AccelerationUnit&gt;; the acceleration of the leader
58       */
59      public final DoubleScalar.Abs<AccelerationUnit> getLeaderAcceleration()
60      {
61          return getLeaderAccelerationStep().getAcceleration();
62      }
63  
64      /**
65       * Return the acceleration of the follower.
66       * @return DoubleScalar&lt;AccelerationUnit&gt;; the acceleration of the follower
67       */
68      public final DoubleScalar.Abs<AccelerationUnit> getFollowerAcceleration()
69      {
70          return getFollowerAccelerationStep().getAcceleration();
71      }
72  
73      /**
74       * Return the time up to which the result of the leader is valid.
75       * @return DoubleScalar&lt;TimeUnit&gt;; the time up to which the result of the leader is valid
76       */
77      public final DoubleScalar.Abs<TimeUnit> getLeaderValidUntil()
78      {
79          return getLeaderAccelerationStep().getValidUntil();
80      }
81  
82      /**
83       * Return the time up to which the result of the follower is valid.
84       * @return DoubleScalar&lt;TimeUnit&gt;; the time up to which the result of the follower is valid
85       */
86      public final DoubleScalar.Abs<TimeUnit> getFollowerValidUntil()
87      {
88          return getFollowerAccelerationStep().getValidUntil();
89      }
90  
91  }