Package de.timmfitschen.easyunits
Class SystemOfUnits
- java.lang.Object
-
- de.timmfitschen.easyunits.SystemOfUnits
-
public class SystemOfUnits extends Object
-
-
Constructor Summary
Constructors Constructor Description SystemOfUnits(Map<String,Unit> allunits)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Numberconvert(Number value, Unit from, Unit to)Numberconvert(Number value, String fromUnit, String toUnit)booleanequals(Object obj)CompoundUnitParsergetCompoundUnitParser()ConvertergetConverter(Unit from, Unit to)UnitgetUnit(String unit)inthashCode()booleanisCommensurable(Unit unit1, Unit unit2)booleanisCommensurable(String unit1, String unit2)protected UnitparseCompound(String unit)voidsetCompoundUnitParser(CompoundUnitParser cup)
-
-
-
Method Detail
-
getUnit
public Unit getUnit(String unit) throws UnknownUnitException, ParserException
- Throws:
UnknownUnitExceptionParserException
-
parseCompound
protected Unit parseCompound(String unit) throws UnknownUnitException, ParserException
- Throws:
UnknownUnitExceptionParserException
-
getConverter
public Converter getConverter(Unit from, Unit to) throws UnitIncommensurabilityException
- Throws:
UnitIncommensurabilityException
-
convert
public Number convert(Number value, Unit from, Unit to) throws UnitIncommensurabilityException
- Throws:
UnitIncommensurabilityException
-
convert
public Number convert(Number value, String fromUnit, String toUnit) throws UnitIncommensurabilityException, UnknownUnitException, ParserException
-
getCompoundUnitParser
public CompoundUnitParser getCompoundUnitParser()
-
setCompoundUnitParser
public void setCompoundUnitParser(CompoundUnitParser cup)
-
isCommensurable
public boolean isCommensurable(String unit1, String unit2) throws UnknownUnitException, ParserException
- Throws:
UnknownUnitExceptionParserException
-
-