1 package org.opentrafficsim.road.gtu.generator.headway;
2
3 import org.djunits.value.vdouble.scalar.Frequency;
4 import org.djunits.value.vdouble.scalar.Time;
5 import org.djunits.value.vdouble.vector.FrequencyVector;
6 import org.djunits.value.vdouble.vector.TimeVector;
7 import org.opentrafficsim.road.od.Interpolation;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 public record DemandPattern(FrequencyVector demandVector, TimeVector timeVector, Interpolation interpolation)
23 implements Arrivals
24 {
25
26
27 @Override
28 public Frequency getFrequency(final Time time, final boolean sliceStart)
29 {
30 return this.interpolation.interpolateVector(time, this.demandVector, this.timeVector, sliceStart);
31 }
32
33
34 @Override
35 public Time nextTimeSlice(final Time time)
36 {
37 for (Time d : this.timeVector)
38 {
39 if (d.gt(time))
40 {
41 return d;
42 }
43 }
44 return null;
45 }
46
47 }