1 package org.opentrafficsim.road.gtu.lane.perception.mental;
2
3 import org.opentrafficsim.base.parameters.ParameterException;
4 import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
5
6
7
8
9
10
11
12
13
14 public abstract class AbstractTask implements Task
15 {
16
17
18 private final String id;
19
20
21 private double taskDemand;
22
23
24
25
26
27 public AbstractTask(final String id)
28 {
29 this.id = id;
30 }
31
32 @Override
33 public double getTaskDemand(final LanePerception perception) throws ParameterException
34 {
35 this.taskDemand = calculateTaskDemand(perception);
36 return this.taskDemand;
37 }
38
39
40
41
42
43
44
45 protected abstract double calculateTaskDemand(LanePerception perception) throws ParameterException;
46
47 @Override
48 public double getTaskDemand()
49 {
50 return this.taskDemand;
51 }
52
53 @Override
54 public String getId()
55 {
56 return this.id;
57 }
58
59 }