1 package org.opentrafficsim.kpi.sampling.data;
2
3 import org.djunits.unit.AbsoluteLinearUnit;
4 import org.djunits.unit.SpeedUnit;
5 import org.djunits.unit.Unit;
6 import org.djunits.value.StorageType;
7 import org.djunits.value.ValueException;
8 import org.djunits.value.vfloat.scalar.FloatSpeed;
9 import org.djunits.value.vfloat.vector.FloatSpeedVector;
10 import org.opentrafficsim.kpi.interfaces.GtuDataInterface;
11
12
13
14
15
16
17
18
19
20
21
22
23
24 public abstract class ExtendedDataTypeSpeed<G extends GtuDataInterface>
25 extends ExtendedDataTypeFloat<SpeedUnit, FloatSpeed, FloatSpeedVector, G>
26 {
27
28
29
30
31
32 public ExtendedDataTypeSpeed(String id)
33 {
34 super(id);
35 }
36
37
38 @Override
39 protected final FloatSpeed convertValue(final float value)
40 {
41 return FloatSpeed.createSI(value);
42 }
43
44
45 @Override
46 protected final FloatSpeedVector convert(final float[] storage) throws ValueException
47 {
48 return new FloatSpeedVector(storage, SpeedUnit.SI, StorageType.DENSE);
49 }
50
51
52 @Override
53 public <AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>> FloatSpeed interpolate(final FloatSpeed value0,
54 final FloatSpeed value1, final double f)
55 {
56 return FloatSpeed.interpolate(value0, value1, (float) f);
57 }
58
59 }