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://github.com/peter-knoppers">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 id
28       */
29      public AbstractTask(final String id)
30      {
31          this.id = id;
32      }
33  
34      @Override
35      public String getId()
36      {
37          return this.id;
38      }
39  
40      @Override
41      public final void setTaskDemand(final double taskDemand)
42      {
43          this.taskDemand = taskDemand;
44      }
45  
46      @Override
47      public final double getTaskDemand()
48      {
49          return this.taskDemand;
50      }
51  
52      @Override
53      public final void setAnticipationReliance(final double anticipationReliance)
54      {
55          this.anticipationReliance = anticipationReliance;
56      }
57  
58      @Override
59      public final double getAnticipationReliance()
60      {
61          return this.anticipationReliance;
62      }
63  
64      @Override
65      public String toString()
66      {
67          return "Task (" + getId() + ")";
68      }
69  }