Class FloatVector


  • public final class FloatVector
    extends Object
    FloatVector utility methods, e.g., for creating FloatVectors from different types of data.

    Copyright (c) 2015-2023 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 Detail

      • 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valuesInUnit - float[]; the values in the given unit
        unit - U; the unit in which the values are expressed and displayed
        storageType - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valuesInUnit - float[]; the values in the given unit
        unit - U; the unit in which the values are expressed and displayed
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valuesSI - float[]; the values in the SI unit
        displayUnit - U; the unit in which the values will be displayed
        storageType - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valuesSI - float[]; the values in the SI unit
        displayUnit - U; the unit in which the values will be displayed
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        values - S[]; the values
        displayUnit - U; the unit in which the values will be displayed
        storageType - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        values - S[]; the values
        displayUnit - U; the unit in which the values will be displayed
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 ValueRuntimeException
        Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.
        Type Parameters:
        U - the unit type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueListInUnit - List<Float>; the values in the given unit
        unit - U; the unit in which the values are expressed and displayed
        storageType - 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 ValueRuntimeException
        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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueListInUnit - List<Float>; the values in the given unit
        unit - U; the unit in which the values are expressed and displayed
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 ValueRuntimeException
        Instantiate the FloatVector based on its unit. Rigid check on types for the compiler.
        Type Parameters:
        U - the unit type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueListSI - List<Float>; the values in the SI unit
        displayUnit - U; the unit in which the values will be displayed
        storageType - 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 ValueRuntimeException
        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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueListSI - List<Float>; the values in the SI unit
        displayUnit - U; the unit in which the values will be displayed
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueList - List<S>; the value list
        displayUnit - U; the unit in which the values will be displayed
        storageType - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueList - List<S>; the value list
        displayUnit - U; the unit in which the values will be displayed
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueMapInUnit - SortedMap<Integer, Float>; the values in the given unit
        length - int; the size of the vector
        unit - U; the unit in which the values are expressed and displayed
        storageType - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueMapInUnit - SortedMap<Integer, Float>; the values in the given unit
        length - int; the size of the vector
        unit - U; the unit in which the values are expressed and displayed
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueMapSI - SortedMap<Integer, Float>; the values in the SI unit
        length - int; the size of the vector
        displayUnit - U; the unit in which the values are displayed
        storageType - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueMapSI - SortedMap<Integer, Float>; the values in the SI unit
        length - int; the size of the vector
        displayUnit - U; the unit in which the values are displayed
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueMap - SortedMap<Integer, S>; the value map
        displayUnit - U; the unit in which the values will be displayed
        length - int; the size of the vector
        storageType - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        valueMap - SortedMap<Integer, S>; the value map
        displayUnit - U; the unit in which the values will be displayed
        length - int; the size of the vector
        storageType - StorageType; whether the vector is SPARSE or DENSE
        vectorClass - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        values - FloatVectorData; the values
        unit - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        values - FloatVectorData; the values
        unit - U; the unit in which the values are expressed
        vectorClass - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        values - FloatVectorData; the values
        unit - 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 type
        S - the corresponding scalar type
        V - the corresponding vector type
        Parameters:
        values - FloatVectorData; the values
        unit - Unit<?>; the unit in which the values are expressed
        vectorClass - Class<V>; the class of the vector to instantiate
        Returns:
        V; an instantiated FloatVector with the values expressed in their unit