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