All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentrafficsim.kpi.sampling.data.ExtendedDataSpeed Maven / Gradle / Ivy

package org.opentrafficsim.kpi.sampling.data;

import org.djunits.unit.SpeedUnit;
import org.djunits.value.ValueRuntimeException;
import org.djunits.value.storage.StorageType;
import org.djunits.value.vfloat.scalar.FloatSpeed;
import org.djunits.value.vfloat.vector.FloatSpeedVector;
import org.djunits.value.vfloat.vector.base.FloatVector;
import org.opentrafficsim.kpi.interfaces.GtuData;

/**
 * Extended data type for speed values.
 * 

* Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License. *

* @author Alexander Verbraeck * @author Peter Knoppers * @author Wouter Schakel * @param gtu data type */ public abstract class ExtendedDataSpeed extends ExtendedDataFloat { /** * Constructor setting the id. * @param id String; id * @param description String; description */ public ExtendedDataSpeed(final String id, final String description) { super(id, description, FloatSpeed.class); } /** {@inheritDoc} */ @Override protected final FloatSpeed convertValue(final float value) { return FloatSpeed.instantiateSI(value); } /** {@inheritDoc} */ @Override protected final FloatSpeedVector convert(final float[] storage) throws ValueRuntimeException { return FloatVector.instantiate(storage, SpeedUnit.SI, StorageType.DENSE); } /** {@inheritDoc} */ @Override public FloatSpeed interpolate(final FloatSpeed value0, final FloatSpeed value1, final double f) { return FloatSpeed.interpolate(value0, value1, (float) f); } /** {@inheritDoc} */ @Override public FloatSpeed parseValue(final String string) { return FloatSpeed.instantiateSI(Float.valueOf(string)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy