Class Quantity<T extends Number,​K>

  • Type Parameters:
    T - data type
    K - grid output format
    Direct Known Subclasses:
    TypedQuantity

    public class Quantity<T extends Number,​K>
    extends Object
    Defines a quantity that data sources can provide, such as speed, flow, etc.

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

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version 24 okt. 2018
    Author:
    Wouter Schakel
    • Field Detail

      • SPEED_SI

        public static final Quantity<Double,​double[][]> SPEED_SI
        Standard quantity for speed.
      • FLOW_SI

        public static final Quantity<Double,​double[][]> FLOW_SI
        Standard quantity for flow.
      • DENSITY_SI

        public static final Quantity<Double,​double[][]> DENSITY_SI
        Standard quantity for density.
    • Constructor Detail

      • Quantity

        public Quantity​(String name,
                        Converter<K> converter)
        Constructor.
        Parameters:
        name - String; name
        converter - Converter<K>; converter for output format
      • Quantity

        protected Quantity​(String name,
                           boolean speed,
                           Converter<K> converter)
        Constructor. Protected so only the default SPEED_SI quantity is speed.
        Parameters:
        name - String; name
        speed - boolean; whether this quantity is speed
        converter - Converter<K>; converter for output format
    • Method Detail

      • si

        public static Quantity<?,​double[][]> si​(String name)
        Returns a quantity with double[][] containing SI values as output format.
        Parameters:
        name - String; name
        Returns:
        quantity with double[][] containing SI values as output format
      • getName

        public final String getName()
        Returns the name.
        Returns:
        String; name
      • isSpeed

        final boolean isSpeed()
        Returns whether this quantity is speed.
        Returns:
        boolean; whether this quantity is speed
      • convert

        final K convert​(double[][] data)
        Converts the filtered data to an output format.
        Parameters:
        data - double[][]; filtered data
        Returns:
        K; output data
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object