View Javadoc
1   package org.opentrafficsim.road.gtu.lane.perception.mental;
2   
3   /**
4    * Has id, task demand and anticipation reliance as internal variables.
5    * <p>
6    * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
7    * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
8    * <p>
9    * @version $Revision$, $LastChangedDate$, by $Author$, initial version 6 nov. 2018 <br>
10   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
11   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
12   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
13   */
14  public abstract class AbstractTask implements Task
15  {
16  
17      /** Id. */
18      private final String id;
19  
20      /** Task demand. */
21      private double taskDemand;
22  
23      /** Anticipation reliance. */
24      private double anticipationReliance;
25  
26      /**
27       * Constructor.
28       * @param id String; id
29       */
30      public AbstractTask(final String id)
31      {
32          this.id = id;
33      }
34  
35      /** {@inheritDoc} */
36      @Override
37      public String getId()
38      {
39          return this.id;
40      }
41  
42      /** {@inheritDoc} */
43      @Override
44      public final void setTaskDemand(final double taskDemand)
45      {
46          this.taskDemand = taskDemand;
47      }
48  
49      /** {@inheritDoc} */
50      @Override
51      public final double getTaskDemand()
52      {
53          return this.taskDemand;
54      }
55  
56      /** {@inheritDoc} */
57      @Override
58      public final void setAnticipationReliance(final double anticipationReliance)
59      {
60          this.anticipationReliance = anticipationReliance;
61      }
62  
63      /** {@inheritDoc} */
64      @Override
65      public final double getAnticipationReliance()
66      {
67          return this.anticipationReliance;
68      }
69  
70      /** {@inheritDoc} */
71      @Override
72      public String toString()
73      {
74          return "Task (" + getId() + ")";
75      }
76  }