![JAR search and dependency download from the Maven repository](/logo.png)
org.opentrafficsim.kpi.sampling.data.ExtendedDataLength Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ots-kpi Show documentation
Show all versions of ots-kpi Show documentation
OpenTrafficSim KPI Module without dependencies to ots-road or ots-core
package org.opentrafficsim.kpi.sampling.data;
import org.djunits.unit.LengthUnit;
import org.djunits.value.ValueRuntimeException;
import org.djunits.value.storage.StorageType;
import org.djunits.value.vfloat.scalar.FloatLength;
import org.djunits.value.vfloat.vector.FloatLengthVector;
import org.djunits.value.vfloat.vector.base.FloatVector;
import org.opentrafficsim.kpi.interfaces.GtuData;
/**
* Extended data type for length 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 ExtendedDataLength
extends ExtendedDataFloat
{
/**
* Constructor setting the id.
* @param id String; id
* @param description String; description
*/
public ExtendedDataLength(final String id, final String description)
{
super(id, description, FloatLength.class);
}
/** {@inheritDoc} */
@Override
protected final FloatLength convertValue(final float value)
{
return FloatLength.instantiateSI(value);
}
/** {@inheritDoc} */
@Override
protected final FloatLengthVector convert(final float[] storage) throws ValueRuntimeException
{
return FloatVector.instantiate(storage, LengthUnit.SI, StorageType.DENSE);
}
/** {@inheritDoc} */
@Override
public FloatLength interpolate(final FloatLength value0, final FloatLength value1, final double f)
{
return FloatLength.interpolate(value0, value1, (float) f);
}
/** {@inheritDoc} */
@Override
public FloatLength parseValue(final String string)
{
return FloatLength.instantiateSI(Float.valueOf(string));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy