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