1 package org.opentrafficsim.kpi.sampling;
2
3 import org.djunits.value.vdouble.scalar.Length;
4 import org.djunits.value.vdouble.scalar.Time;
5 import org.djutils.exceptions.Throw;
6 import org.opentrafficsim.kpi.interfaces.LaneData;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 public record SpaceTimeRegion<L extends LaneData<L>>(L lane, Length startPosition, Length endPosition, Time startTime,
25 Time endTime)
26 {
27
28
29
30
31
32
33
34
35
36
37 public SpaceTimeRegion
38 {
39 Throw.whenNull(startPosition, "Start position may not be null.");
40 Throw.whenNull(endPosition, "End position may not be null.");
41 Throw.whenNull(startTime, "Start time may not be null.");
42 Throw.whenNull(endTime, "End time may not be null.");
43 Throw.when(endPosition.lt(startPosition), IllegalArgumentException.class,
44 "End position should be greater than start position.");
45 Throw.when(endTime.lt(startTime), IllegalArgumentException.class, "End time should be greater than start time.");
46 }
47
48 }