View Javadoc
1   package org.opentrafficsim.road.gtu.lane.perception.mental.channel;
2   
3   import org.opentrafficsim.base.parameters.ParameterException;
4   import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
5   import org.opentrafficsim.road.gtu.lane.perception.mental.AbstractTask;
6   
7   /**
8    * Constant task demand.
9    * <p>
10   * Copyright (c) 2024-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
12   * </p>
13   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
14   */
15  public class ChannelTaskConstant extends AbstractTask implements ChannelTask
16  {
17  
18      /** Channel. */
19      private final Object channel;
20  
21      /** Task demand. */
22      private final double taskDemand;
23  
24      /**
25       * Constructor.
26       * @param id id
27       * @param channel channel
28       * @param taskDemand task demand
29       */
30      public ChannelTaskConstant(final String id, final Object channel, final double taskDemand)
31      {
32          super(id);
33          this.channel = channel;
34          this.taskDemand = taskDemand;
35      }
36  
37      @Override
38      public Object getChannel()
39      {
40          return this.channel;
41      }
42  
43      @Override
44      protected double calculateTaskDemand(final LanePerception perception) throws ParameterException
45      {
46          return this.taskDemand;
47      }
48  
49  }