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