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-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
7    * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
8    * </p>
9    * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
10   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
11   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
12   */
13  public abstract class AbstractTask implements Task
14  {
15  
16      /** Id. */
17      private final String id;
18  
19      /** Task demand. */
20      private double taskDemand;
21  
22      /** Anticipation reliance. */
23      private double anticipationReliance;
24  
25      /**
26       * Constructor.
27       * @param id String; id
28       */
29      public AbstractTask(final String id)
30      {
31          this.id = id;
32      }
33  
34      /** {@inheritDoc} */
35      @Override
36      public String getId()
37      {
38          return this.id;
39      }
40  
41      /** {@inheritDoc} */
42      @Override
43      public final void setTaskDemand(final double taskDemand)
44      {
45          this.taskDemand = taskDemand;
46      }
47  
48      /** {@inheritDoc} */
49      @Override
50      public final double getTaskDemand()
51      {
52          return this.taskDemand;
53      }
54  
55      /** {@inheritDoc} */
56      @Override
57      public final void setAnticipationReliance(final double anticipationReliance)
58      {
59          this.anticipationReliance = anticipationReliance;
60      }
61  
62      /** {@inheritDoc} */
63      @Override
64      public final double getAnticipationReliance()
65      {
66          return this.anticipationReliance;
67      }
68  
69      /** {@inheritDoc} */
70      @Override
71      public String toString()
72      {
73          return "Task (" + getId() + ")";
74      }
75  }