View Javadoc
1   package org.opentrafficsim.road.gtu.lane.perception.mental;
2   
3   import org.opentrafficsim.base.parameters.ParameterException;
4   import org.opentrafficsim.base.parameters.Parameters;
5   import org.opentrafficsim.core.gtu.GtuException;
6   import org.opentrafficsim.road.gtu.lane.LaneBasedGtu;
7   import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
8   
9   /**
10   * Class for constant demand.
11   * <p>
12   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
13   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
14   * </p>
15   * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
16   * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
17   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
18   */
19  public class ConstantTask extends AbstractTask
20  {
21      /**
22       * Constructor.
23       * @param id String; id
24       * @param taskDemand double; task demand
25       */
26      public ConstantTask(final String id, final double taskDemand)
27      {
28          super(id);
29          setTaskDemand(taskDemand);
30      }
31  
32      /** {@inheritDoc} */
33      @Override
34      public double calculateTaskDemand(final LanePerception perception, final LaneBasedGtu gtu, final Parameters parameters)
35              throws ParameterException, GtuException
36      {
37          return getTaskDemand();
38      }
39  }