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 SerializationUnitsABSOLUTETEMPERATUREAbsoluteTemperature unit type with code 24.static SerializationUnitsABSORBEDDOSEAbsorbedDose unit type with code 29.static SerializationUnitsACCELERATIONAcceleration unit type with code 1.static SerializationUnitsAMOUNTOFSUBSTANCEAmountOfSubstance unit type with code 30.static SerializationUnitsANGLEAngle unit type with code 3.static SerializationUnitsANGULARACCELERATIONAngularAcceleration unit type with code 42.static SerializationUnitsANGULARVELOCITYAngularVelocity unit type with code 43.static SerializationUnitsAREAArea unit type with code 5.static SerializationUnitsCATALYTICACTIVITYCatalyticActivity unit type with code 31.static SerializationUnitsDENSITYDensity unit type with code 6.static SerializationUnitsDIMENSIONLESSDimensionless unit type with code 0.static SerializationUnitsDIRECTIONDirection unit type with code 4.static SerializationUnitsDURATIONDuration unit type with code 25.static SerializationUnitsELECTRICALCAPACITANCEElectricalCapacitance unit type with code 32.static SerializationUnitsELECTRICALCHARGEElectricalCharge unit type with code 7.static SerializationUnitsELECTRICALCONDUCTANCEElectricalConductance unit type with code 33.static SerializationUnitsELECTRICALCURRENTElectricalCurrent unit type with code 8.static SerializationUnitsELECTRICALINDUCTANCEElectricalInductance unit type with code 34.static SerializationUnitsELECTRICALPOTENTIALElectricalPotential unit type with code 9.static SerializationUnitsELECTRICALRESISTANCEElectricalResistance unit type with code 10.static SerializationUnitsENERGYEnergy unit type with code 11.static SerializationUnitsEQUIVALENTDOSEEquivalentDose unit type with code 35.static SerializationUnitsFLOWMASSFlowMass unit type with code 12.static SerializationUnitsFLOWVOLUMEFlowVolume unit type with code 13.static SerializationUnitsFORCEForce unit type with code 14.static SerializationUnitsFREQUENCYFrequency unit type with code 15.static SerializationUnitsILLUMINANCEIlluminance unit type with code 36.static SerializationUnitsLENGTHLength unit type with code 16.static SerializationUnitsLINEARDENSITYLinearDensity unit type with code 18.static SerializationUnitsLUMINOUSFLUXLuminousFlux unit type with code 37.static SerializationUnitsLUMINOUSINTENSITYLuminousIntensity unit type with code 38.static SerializationUnitsMAGNETICFLUXMagneticFlux unit type with code 40.static SerializationUnitsMAGNETICFLUXDENSITYMagneticFluxDensity unit type with code 39.static SerializationUnitsMASSMass unit type with code 19.static SerializationUnitsMOMENTUMAngularAcceleration unit type with code 44.static SerializationUnitsPOSITIONPosition unit type with code 17.static SerializationUnitsPOWERPower unit type with code 20.static SerializationUnitsPRESSUREPressure unit type with code 21.static SerializationUnitsRADIOACTIVITYRadioActivity unit type with code 41.static SerializationUnitsSOLIDANGLESolidAngle unit type with code 2.static SerializationUnitsSPEEDSpeed unit type with code 22.static SerializationUnitsTEMPERATURETemperature unit type with code 23.static SerializationUnitsTIMETime unit type with code 26.static SerializationUnitsTORQUETorque unit type with code 27.static SerializationUnitsVOLUMEVolume 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
Modifier and Type Method Description booleanequals(Object obj)bytegetCode()Retrieve the byte code of this UnitType.StringgetDescription()Retrieve the description of this UnitType.Class<? extends org.djunits.unit.Unit<?>>getDjunitsType()Retrieve the DJUNITS type of this UnitType.StringgetName()Retrieve the name of the UnitType.StringgetSiUnit()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 SerializationUnitsgetUnitType(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.inthashCode()StringtoString() 
- 
Field Details
- 
DIMENSIONLESS
Dimensionless unit type with code 0. - 
ACCELERATION
Acceleration unit type with code 1. - 
SOLIDANGLE
SolidAngle unit type with code 2. - 
ANGLE
Angle unit type with code 3. - 
DIRECTION
Direction unit type with code 4. - 
AREA
Area unit type with code 5. - 
DENSITY
Density unit type with code 6. - 
ELECTRICALCHARGE
ElectricalCharge unit type with code 7. - 
ELECTRICALCURRENT
ElectricalCurrent unit type with code 8. - 
ELECTRICALPOTENTIAL
ElectricalPotential unit type with code 9. - 
ELECTRICALRESISTANCE
ElectricalResistance unit type with code 10. - 
ENERGY
Energy unit type with code 11. - 
FLOWMASS
FlowMass unit type with code 12. - 
FLOWVOLUME
FlowVolume unit type with code 13. - 
FORCE
Force unit type with code 14. - 
FREQUENCY
Frequency unit type with code 15. - 
LENGTH
Length unit type with code 16. - 
POSITION
Position unit type with code 17. - 
LINEARDENSITY
LinearDensity unit type with code 18. - 
MASS
Mass unit type with code 19. - 
POWER
Power unit type with code 20. - 
PRESSURE
Pressure unit type with code 21. - 
SPEED
Speed unit type with code 22. - 
TEMPERATURE
Temperature unit type with code 23. - 
ABSOLUTETEMPERATURE
AbsoluteTemperature unit type with code 24. - 
DURATION
Duration unit type with code 25. - 
TIME
Time unit type with code 26. - 
TORQUE
Torque unit type with code 27. - 
VOLUME
Volume unit type with code 28. - 
ABSORBEDDOSE
AbsorbedDose unit type with code 29. - 
AMOUNTOFSUBSTANCE
AmountOfSubstance unit type with code 30. - 
CATALYTICACTIVITY
CatalyticActivity unit type with code 31. - 
ELECTRICALCAPACITANCE
ElectricalCapacitance unit type with code 32. - 
ELECTRICALCONDUCTANCE
ElectricalConductance unit type with code 33. - 
ELECTRICALINDUCTANCE
ElectricalInductance unit type with code 34. - 
EQUIVALENTDOSE
EquivalentDose unit type with code 35. - 
ILLUMINANCE
Illuminance unit type with code 36. - 
LUMINOUSFLUX
LuminousFlux unit type with code 37. - 
LUMINOUSINTENSITY
LuminousIntensity unit type with code 38. - 
MAGNETICFLUXDENSITY
MagneticFluxDensity unit type with code 39. - 
MAGNETICFLUX
MagneticFlux unit type with code 40. - 
RADIOACTIVITY
RadioActivity unit type with code 41. - 
ANGULARACCELERATION
AngularAcceleration unit type with code 42. - 
ANGULARVELOCITY
AngularVelocity unit type with code 43. - 
MOMENTUM
AngularAcceleration unit type with code 44. 
 - 
 - 
Constructor Details
- 
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 Details
- 
getUnitType
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
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
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
Retrieve the DJUNITS type of this UnitType.- Returns:
 - Class; the DJUNITS type of this UnitType
 
 - 
getName
Retrieve the name of the UnitType.- Returns:
 - String; the name of this UnitType
 
 - 
getDescription
Retrieve the description of this UnitType.- Returns:
 - String; the description of this UnitType
 
 - 
getSiUnit
Retrieve the SI unit of this UnitType.- Returns:
 - String the SI unit of this UnitType
 
 - 
hashCode
public int hashCode() - 
equals
 - 
toString
 
 -