Class FloatVector
java.lang.Object
org.djunits.value.vfloat.vector.base.FloatVector
public final class FloatVector extends Object
FloatVector utility methods, e.g., for creating FloatVectors from different types of data.
Copyright (c) 2015-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck, Peter Knoppers
-
Method Summary
Modifier and Type Method Description static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(float[] valuesInUnit, U unit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(float[] valuesInUnit, U unit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(List<Float> valueListInUnit, U unit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(List<Float> valueListInUnit, U unit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(SortedMap<Integer,Float> valueMapInUnit, int length, U unit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(SortedMap<Integer,Float> valueMapInUnit, int length, U unit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(FloatVectorData values, U unit)Instantiate the Mutable FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(FloatVectorData values, U unit, Class<V> vectorClass)Instantiate the Mutable FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(S[] values, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
Vinstantiate(S[] values, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateAnonymous(FloatVectorData values, Unit<?> unit)Instantiate the Immutable FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateAnonymous(FloatVectorData values, Unit<?> unit, Class<V> vectorClass)Instantiate the Immutable FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateList(List<S> valueList, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateList(List<S> valueList, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateMap(SortedMap<Integer,S> valueMap, int length, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateMap(SortedMap<Integer,S> valueMap, int length, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateSI(float[] valuesSI, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateSI(float[] valuesSI, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateSI(List<Float> valueListSI, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateSI(List<Float> valueListSI, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateSI(SortedMap<Integer,Float> valueMapSI, int length, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit.static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>>
VinstantiateSI(SortedMap<Integer,Float> valueMapSI, int length, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit.
-
Method Details
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(float[] valuesInUnit, U unit, StorageType storageType)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valuesInUnit- float[]; the values in the given unitunit- U; the unit in which the values are expressed and displayedstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(float[] valuesInUnit, U unit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valuesInUnit- float[]; the values in the given unitunit- U; the unit in which the values are expressed and displayedstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiateSI
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateSI(float[] valuesSI, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valuesSI- float[]; the values in the SI unitdisplayUnit- U; the unit in which the values will be displayedstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiateSI
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateSI(float[] valuesSI, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valuesSI- float[]; the values in the SI unitdisplayUnit- U; the unit in which the values will be displayedstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(S[] values, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
values- S[]; the valuesdisplayUnit- U; the unit in which the values will be displayedstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(S[] values, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
values- S[]; the valuesdisplayUnit- U; the unit in which the values will be displayedstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(List<Float> valueListInUnit, U unit, StorageType storageType) throws ValueRuntimeExceptionInstantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueListInUnit- List<Float>; the values in the given unitunit- U; the unit in which the values are expressed and displayedstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
- Throws:
ValueRuntimeException- on vector init error
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(List<Float> valueListInUnit, U unit, StorageType storageType, Class<V> vectorClass) throws ValueRuntimeExceptionInstantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueListInUnit- List<Float>; the values in the given unitunit- U; the unit in which the values are expressed and displayedstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
- Throws:
ValueRuntimeException- on vector init error
-
instantiateSI
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateSI(List<Float> valueListSI, U displayUnit, StorageType storageType) throws ValueRuntimeExceptionInstantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueListSI- List<Float>; the values in the SI unitdisplayUnit- U; the unit in which the values will be displayedstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
- Throws:
ValueRuntimeException- on vector init error
-
instantiateSI
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateSI(List<Float> valueListSI, U displayUnit, StorageType storageType, Class<V> vectorClass) throws ValueRuntimeExceptionInstantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueListSI- List<Float>; the values in the SI unitdisplayUnit- U; the unit in which the values will be displayedstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
- Throws:
ValueRuntimeException- on vector init error
-
instantiateList
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateList(List<S> valueList, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueList- List<S>; the value listdisplayUnit- U; the unit in which the values will be displayedstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiateList
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateList(List<S> valueList, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueList- List<S>; the value listdisplayUnit- U; the unit in which the values will be displayedstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(SortedMap<Integer,Float> valueMapInUnit, int length, U unit, StorageType storageType)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueMapInUnit- SortedMap<Integer, Float>; the values in the given unitlength- int; the size of the vectorunit- U; the unit in which the values are expressed and displayedstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(SortedMap<Integer,Float> valueMapInUnit, int length, U unit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueMapInUnit- SortedMap<Integer, Float>; the values in the given unitlength- int; the size of the vectorunit- U; the unit in which the values are expressed and displayedstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiateSI
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateSI(SortedMap<Integer,Float> valueMapSI, int length, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueMapSI- SortedMap<Integer, Float>; the values in the SI unitlength- int; the size of the vectordisplayUnit- U; the unit in which the values are displayedstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiateSI
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateSI(SortedMap<Integer,Float> valueMapSI, int length, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueMapSI- SortedMap<Integer, Float>; the values in the SI unitlength- int; the size of the vectordisplayUnit- U; the unit in which the values are displayedstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiateMap
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateMap(SortedMap<Integer,S> valueMap, int length, U displayUnit, StorageType storageType)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueMap- SortedMap<Integer, S>; the value mapdisplayUnit- U; the unit in which the values will be displayedlength- int; the size of the vectorstorageType- StorageType; whether the vector is SPARSE or DENSE- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiateMap
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateMap(SortedMap<Integer,S> valueMap, int length, U displayUnit, StorageType storageType, Class<V> vectorClass)Instantiate the FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
valueMap- SortedMap<Integer, S>; the value mapdisplayUnit- U; the unit in which the values will be displayedlength- int; the size of the vectorstorageType- StorageType; whether the vector is SPARSE or DENSEvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(FloatVectorData values, U unit)Instantiate the Mutable FloatVector based on its unit. Rigid check on types for the compiler.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
values- FloatVectorData; the valuesunit- U; the unit in which the values are expressed- Returns:
- V; an instantiated mutable FloatVector with the values expressed in their unit
-
instantiate
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiate(FloatVectorData values, U unit, Class<V> vectorClass)Instantiate the Mutable FloatVector based on its unit. Rigid check on types for the compiler. The class for the vector is explicitly provided, e.g., for user-defined vector classes.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
values- FloatVectorData; the valuesunit- U; the unit in which the values are expressedvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated mutable FloatVector with the values expressed in their unit
-
instantiateAnonymous
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateAnonymous(FloatVectorData values, Unit<?> unit)Instantiate the Immutable FloatVector based on its unit. Loose check for types on the compiler. This allows the unit to be specified as a Unit<?> type.
Note that it is possible to make mistakes with anonymous units.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
values- FloatVectorData; the valuesunit- Unit<?>; the unit in which the values are expressed- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-
instantiateAnonymous
public static <U extends Unit<U>, S extends FloatScalarInterface<U, S>, V extends FloatVectorInterface<U, S, V>> V instantiateAnonymous(FloatVectorData values, Unit<?> unit, Class<V> vectorClass)Instantiate the Immutable FloatVector based on its unit. Loose check for types on the compiler. This allows the unit to be specified as a Unit<?> type. The class for the vector is explicitly provided, e.g., for user-defined vector classes.
Note that it is possible to make mistakes with anonymous units.- Type Parameters:
U- the unit typeS- the corresponding scalar typeV- the corresponding vector type- Parameters:
values- FloatVectorData; the valuesunit- Unit<?>; the unit in which the values are expressedvectorClass- Class<V>; the class of the vector to instantiate- Returns:
- V; an instantiated FloatVector with the values expressed in their unit
-