Package org.djutils.serialization
Class SerializationUnits
- java.lang.Object
-
- org.djutils.serialization.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 Summary
Fields Modifier and Type Field Description static SerializationUnits
ABSOLUTETEMPERATURE
AbsoluteTemperature unit type with code 24.static SerializationUnits
ABSORBEDDOSE
AbsorbedDose unit type with code 29.static SerializationUnits
ACCELERATION
Acceleration unit type with code 1.static SerializationUnits
AMOUNTOFSUBSTANCE
AmountOfSubstance unit type with code 30.static SerializationUnits
ANGLE
Angle unit type with code 3.static SerializationUnits
ANGULARACCELERATION
AngularAcceleration unit type with code 42.static SerializationUnits
ANGULARVELOCITY
AngularVelocity unit type with code 43.static SerializationUnits
AREA
Area unit type with code 5.static SerializationUnits
CATALYTICACTIVITY
CatalyticActivity unit type with code 31.static SerializationUnits
DENSITY
Density unit type with code 6.static SerializationUnits
DIMENSIONLESS
Dimensionless unit type with code 0.static SerializationUnits
DIRECTION
Direction unit type with code 4.static SerializationUnits
DURATION
Duration unit type with code 25.static SerializationUnits
ELECTRICALCAPACITANCE
ElectricalCapacitance unit type with code 32.static SerializationUnits
ELECTRICALCHARGE
ElectricalCharge unit type with code 7.static SerializationUnits
ELECTRICALCONDUCTANCE
ElectricalConductance unit type with code 33.static SerializationUnits
ELECTRICALCURRENT
ElectricalCurrent unit type with code 8.static SerializationUnits
ELECTRICALINDUCTANCE
ElectricalInductance unit type with code 34.static SerializationUnits
ELECTRICALPOTENTIAL
ElectricalPotential unit type with code 9.static SerializationUnits
ELECTRICALRESISTANCE
ElectricalResistance unit type with code 10.static SerializationUnits
ENERGY
Energy unit type with code 11.static SerializationUnits
EQUIVALENTDOSE
EquivalentDose unit type with code 35.static SerializationUnits
FLOWMASS
FlowMass unit type with code 12.static SerializationUnits
FLOWVOLUME
FlowVolume unit type with code 13.static SerializationUnits
FORCE
Force unit type with code 14.static SerializationUnits
FREQUENCY
Frequency unit type with code 15.static SerializationUnits
ILLUMINANCE
Illuminance unit type with code 36.static SerializationUnits
LENGTH
Length unit type with code 16.static SerializationUnits
LINEARDENSITY
LinearDensity unit type with code 18.static SerializationUnits
LUMINOUSFLUX
LuminousFlux unit type with code 37.static SerializationUnits
LUMINOUSINTENSITY
LuminousIntensity unit type with code 38.static SerializationUnits
MAGNETICFLUX
MagneticFlux unit type with code 40.static SerializationUnits
MAGNETICFLUXDENSITY
MagneticFluxDensity unit type with code 39.static SerializationUnits
MASS
Mass unit type with code 19.static SerializationUnits
MOMENTUM
AngularAcceleration unit type with code 44.static SerializationUnits
POSITION
Position unit type with code 17.static SerializationUnits
POWER
Power unit type with code 20.static SerializationUnits
PRESSURE
Pressure unit type with code 21.static SerializationUnits
RADIOACTIVITY
RadioActivity unit type with code 41.static SerializationUnits
SOLIDANGLE
SolidAngle unit type with code 2.static SerializationUnits
SPEED
Speed unit type with code 22.static SerializationUnits
TEMPERATURE
Temperature unit type with code 23.static SerializationUnits
TIME
Time unit type with code 26.static SerializationUnits
TORQUE
Torque unit type with code 27.static SerializationUnits
VOLUME
Volume unit type with code 28.
-
Constructor Summary
Constructors Constructor Description SerializationUnits(int code, Class<U> djunitsType, String name, String description, String siUnit)
Construct a new UnitType and put it in the maps.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
byte
getCode()
Retrieve the byte code of this UnitType.String
getDescription()
Retrieve the description of this UnitType.Class<? extends org.djunits.unit.Unit<?>>
getDjunitsType()
Retrieve the DJUNITS type of this UnitType.String
getName()
Retrieve the name of the UnitType.String
getSiUnit()
Retrieve the SI unit of this UnitType.static Class<? extends org.djunits.unit.Unit<?>>
getUnitClass(byte code)
Return the unit class belonging to the byte code.static <U extends org.djunits.unit.Unit<U>>
bytegetUnitCode(U unit)
Return the byte code belonging to the unit class.static SerializationUnits
getUnitType(byte code)
Return the unit type belonging to the byte code.static <U extends org.djunits.unit.Unit<U>>
SerializationUnitsgetUnitType(U unit)
Return the unit type belonging to the unit class.int
hashCode()
String
toString()
-
-
-
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.
-
ANGLE
public static final SerializationUnits ANGLE
Angle unit type with code 3.
-
DIRECTION
public static final SerializationUnits DIRECTION
Direction unit type with code 4.
-
AREA
public static final SerializationUnits AREA
Area unit type with code 5.
-
DENSITY
public static final SerializationUnits DENSITY
Density unit type with code 6.
-
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.
-
ENERGY
public static final SerializationUnits ENERGY
Energy unit type with code 11.
-
FLOWMASS
public static final SerializationUnits FLOWMASS
FlowMass unit type with code 12.
-
FLOWVOLUME
public static final SerializationUnits FLOWVOLUME
FlowVolume unit type with code 13.
-
FORCE
public static final SerializationUnits FORCE
Force unit type with code 14.
-
FREQUENCY
public static final SerializationUnits FREQUENCY
Frequency unit type with code 15.
-
LENGTH
public static final SerializationUnits LENGTH
Length unit type with code 16.
-
POSITION
public static final SerializationUnits POSITION
Position unit type with code 17.
-
LINEARDENSITY
public static final SerializationUnits LINEARDENSITY
LinearDensity unit type with code 18.
-
MASS
public static final SerializationUnits MASS
Mass unit type with code 19.
-
POWER
public static final SerializationUnits POWER
Power unit type with code 20.
-
PRESSURE
public static final SerializationUnits PRESSURE
Pressure unit type with code 21.
-
SPEED
public static final SerializationUnits SPEED
Speed unit type with code 22.
-
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.
-
TIME
public static final SerializationUnits TIME
Time unit type with code 26.
-
TORQUE
public static final SerializationUnits TORQUE
Torque unit type with code 27.
-
VOLUME
public static final SerializationUnits VOLUME
Volume unit type with code 28.
-
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 intdjunitsType
- Class<U>; the djunits data typename
- String; the unit namedescription
- String; the unit descriptionsiUnit
- 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
-
-