Class SerializationUnits

  • All Implemented Interfaces:
    Serializable

    public class SerializationUnits
    extends Object
    implements Serializable
    The Sim0MQ unit types with their code, including static methods to quickly find a unit type.

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

    Author:
    Alexander Verbraeck
    See Also:
    Serialized Form
    • Field Detail

      • DIMENSIONLESS

        public static final SerializationUnits DIMENSIONLESS
        Dimensionless unit type with code 0.
      • ACCELERATION

        public static final SerializationUnits ACCELERATION
        Acceleration unit type with code 1.
      • SOLIDANGLE

        public static final SerializationUnits SOLIDANGLE
        SolidAngle unit type with code 2.
      • DIRECTION

        public static final SerializationUnits DIRECTION
        Direction unit type with code 4.
      • ELECTRICALCHARGE

        public static final SerializationUnits ELECTRICALCHARGE
        ElectricalCharge unit type with code 7.
      • ELECTRICALCURRENT

        public static final SerializationUnits ELECTRICALCURRENT
        ElectricalCurrent unit type with code 8.
      • ELECTRICALPOTENTIAL

        public static final SerializationUnits ELECTRICALPOTENTIAL
        ElectricalPotential unit type with code 9.
      • ELECTRICALRESISTANCE

        public static final SerializationUnits ELECTRICALRESISTANCE
        ElectricalResistance unit type with code 10.
      • FLOWMASS

        public static final SerializationUnits FLOWMASS
        FlowMass unit type with code 12.
      • FLOWVOLUME

        public static final SerializationUnits FLOWVOLUME
        FlowVolume unit type with code 13.
      • FREQUENCY

        public static final SerializationUnits FREQUENCY
        Frequency unit type with code 15.
      • POSITION

        public static final SerializationUnits POSITION
        Position unit type with code 17.
      • LINEARDENSITY

        public static final SerializationUnits LINEARDENSITY
        LinearDensity unit type with code 18.
      • PRESSURE

        public static final SerializationUnits PRESSURE
        Pressure unit type with code 21.
      • TEMPERATURE

        public static final SerializationUnits TEMPERATURE
        Temperature unit type with code 23.
      • ABSOLUTETEMPERATURE

        public static final SerializationUnits ABSOLUTETEMPERATURE
        AbsoluteTemperature unit type with code 24.
      • DURATION

        public static final SerializationUnits DURATION
        Duration unit type with code 25.
      • ABSORBEDDOSE

        public static final SerializationUnits ABSORBEDDOSE
        AbsorbedDose unit type with code 29.
      • AMOUNTOFSUBSTANCE

        public static final SerializationUnits AMOUNTOFSUBSTANCE
        AmountOfSubstance unit type with code 30.
      • CATALYTICACTIVITY

        public static final SerializationUnits CATALYTICACTIVITY
        CatalyticActivity unit type with code 31.
      • ELECTRICALCAPACITANCE

        public static final SerializationUnits ELECTRICALCAPACITANCE
        ElectricalCapacitance unit type with code 32.
      • ELECTRICALCONDUCTANCE

        public static final SerializationUnits ELECTRICALCONDUCTANCE
        ElectricalConductance unit type with code 33.
      • ELECTRICALINDUCTANCE

        public static final SerializationUnits ELECTRICALINDUCTANCE
        ElectricalInductance unit type with code 34.
      • EQUIVALENTDOSE

        public static final SerializationUnits EQUIVALENTDOSE
        EquivalentDose unit type with code 35.
      • ILLUMINANCE

        public static final SerializationUnits ILLUMINANCE
        Illuminance unit type with code 36.
      • LUMINOUSFLUX

        public static final SerializationUnits LUMINOUSFLUX
        LuminousFlux unit type with code 37.
      • LUMINOUSINTENSITY

        public static final SerializationUnits LUMINOUSINTENSITY
        LuminousIntensity unit type with code 38.
      • MAGNETICFLUXDENSITY

        public static final SerializationUnits MAGNETICFLUXDENSITY
        MagneticFluxDensity unit type with code 39.
      • MAGNETICFLUX

        public static final SerializationUnits MAGNETICFLUX
        MagneticFlux unit type with code 40.
      • RADIOACTIVITY

        public static final SerializationUnits RADIOACTIVITY
        RadioActivity unit type with code 41.
      • ANGULARACCELERATION

        public static final SerializationUnits ANGULARACCELERATION
        AngularAcceleration unit type with code 42.
      • ANGULARVELOCITY

        public static final SerializationUnits ANGULARVELOCITY
        AngularVelocity unit type with code 43.
      • MOMENTUM

        public static final SerializationUnits MOMENTUM
        AngularAcceleration unit type with code 44.
    • Constructor Detail

      • SerializationUnits

        public SerializationUnits​(int code,
                                  Class<U> djunitsType,
                                  String name,
                                  String description,
                                  String siUnit)
        Construct a new UnitType and put it in the maps.
        Type Parameters:
        U - the Unit
        Parameters:
        code - int; the byte code of the unit provided as an int
        djunitsType - Class<U>; the djunits data type
        name - String; the unit name
        description - String; the unit description
        siUnit - String; the SI or default unit in SI-elements
    • Method Detail

      • getUnitType

        public static SerializationUnits getUnitType​(byte code)
        Return the unit type belonging to the byte code.
        Parameters:
        code - byte; the code to search for.
        Returns:
        UnitType; the unit type, or null if not found.
      • getUnitClass

        public static Class<? extends org.djunits.unit.Unit<?>> getUnitClass​(byte code)
        Return the unit class belonging to the byte code.
        Parameters:
        code - byte; the code to search for.
        Returns:
        Class; the unit class, or null if not found.
      • getUnitType

        public static <U extends org.djunits.unit.Unit<U>> SerializationUnits getUnitType​(U unit)
        Return the unit type belonging to the unit class.
        Type Parameters:
        U - the Unit
        Parameters:
        unit - U; the unit to search for.
        Returns:
        UnitType; the unit type, or null if not found.
      • getUnitCode

        public static <U extends org.djunits.unit.Unit<U>> byte getUnitCode​(U unit)
        Return the byte code belonging to the unit class.
        Type Parameters:
        U - the Unit
        Parameters:
        unit - U; the unit to search for.
        Returns:
        byte; the unit type code, or null if not found.
      • getCode

        public final byte getCode()
        Retrieve the byte code of this UnitType.
        Returns:
        byte; the byte code of this UnitType
      • getDjunitsType

        public final Class<? extends org.djunits.unit.Unit<?>> getDjunitsType()
        Retrieve the DJUNITS type of this UnitType.
        Returns:
        Class; the DJUNITS type of this UnitType
      • getName

        public final String getName()
        Retrieve the name of the UnitType.
        Returns:
        String; the name of this UnitType
      • getDescription

        public final String getDescription()
        Retrieve the description of this UnitType.
        Returns:
        String; the description of this UnitType
      • getSiUnit

        public final String getSiUnit()
        Retrieve the SI unit of this UnitType.
        Returns:
        String the SI unit of this UnitType
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object