Package info.monitorenter.util.units
Class UnitFactory
- java.lang.Object
-
- info.monitorenter.util.units.UnitFactory
-
public final class UnitFactory extends java.lang.ObjectSingleton that caches instances of whole unit- systems and provides you with the matching unit for a maximum value.- Version:
- $Revision: 1.10 $
- Author:
- Achim Westermann
- See Also:
IUnitSystem
-
-
Field Summary
Fields Modifier and Type Field Description static AUnitUNCHANGEDMarker unit that represents a "non-unit" that does not modify anything inAUnit.getValue(double).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnitFactorygetInstance()Singleton retrieval method.AUnitgetUnit(double absoluteMax, IUnitSystem units)Returns the unit for the given argument absolute max.java.util.List<AUnit>getUnits(IUnitSystem unitsystem)Returns a list of all differentAUnitinstances available in the given unit system.
-
-
-
Field Detail
-
UNCHANGED
public static final AUnit UNCHANGED
Marker unit that represents a "non-unit" that does not modify anything inAUnit.getValue(double).
-
-
Method Detail
-
getInstance
public static UnitFactory getInstance()
Singleton retrieval method.- Returns:
- the unique instance within the current VM.
-
getUnit
public AUnit getUnit(double absoluteMax, IUnitSystem units)
Returns the unit for the given argument absolute max.The unit is chosen in a way that
- Parameters:
absoluteMax- the absolute maximum value that has to be put into relation to the unit to retrieve.units- the UnitSystem to use.- Returns:
- the unit for the given argument absolute max.
-
getUnits
public java.util.List<AUnit> getUnits(IUnitSystem unitsystem)
Returns a list of all differentAUnitinstances available in the given unit system.- Parameters:
unitsystem- the unit system of interest.- Returns:
- a list of all different
AUnitinstances available in the given unit system.
-
-