Package org.djunits.unit.quantity
Class Quantities
java.lang.Object
org.djunits.unit.quantity.Quantities
- All Implemented Interfaces:
Serializable
public final class Quantities extends Object implements Serializable
UnitTypes is a singleton where the BaseUnit SIDimensions 'fingerprints' are stored and mapped to the BaseUnits. It is
possible that more baseUnits have the same fingerprint. E.g., Energy and Torque.
Copyright (c) 2019-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License
- Author:
- Alexander Verbraeck
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static Quantities
INSTANCE
The one instance. -
Method Summary
Modifier and Type Method Description Set<Quantity<?>>
getQuantities(SIDimensions siDimensions)
Retrieve a safe copy of the quantity set registered for an SI fingerprint.Quantity<?>
getQuantity(String unitClassName)
Return the Quantity for a given name of a unit class, or null if it has not been registered.Map<String,Quantity<?>>
getRegistry()
void
register(Quantity<?> quantity)
Register the baseUnit in the UnitType registries.String
toString()
void
unregister(Quantity<?> baseUnit)
Unregister the baseUnit in the UnitType registries.
-
Field Details
-
INSTANCE
The one instance.
-
-
Method Details
-
register
Register the baseUnit in the UnitType registries.- Parameters:
quantity
- Quantity<?>; the quantity to register.
-
unregister
Unregister the baseUnit in the UnitType registries.- Parameters:
baseUnit
- Quantity<?>; the quantity to register.
-
getQuantities
Retrieve a safe copy of the quantity set registered for an SI fingerprint.- Parameters:
siDimensions
- SIDimensions; the SI dimensions to search for- Returns:
- a safe copy of the baseUnit set registered for this SI dimensions fingerprint
-
getQuantity
Return the Quantity for a given name of a unit class, or null if it has not been registered.- Parameters:
unitClassName
- String; the unit class name to search for, e.g., "LengthUnit"- Returns:
- Quantity; the quantity belonging to the class, or null if not found
-
getRegistry
- Returns:
- a defensive copy of the registry
-
toString
-