Constructor and Description |
---|
GPercentUnit(String unitName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
BigDecimal |
convertFromMemory(BigDecimal value)
Converts the value from the memory unit.
|
double |
convertFromMemory(double value)
Converts the value from the memory unit.
|
BigDecimal |
convertToMemory(BigDecimal value)
Converts the value to the memory unit.
|
double |
convertToMemory(double value)
Converts the value to the memory unit.
|
BigDecimal |
convertToUnit(BigDecimal value,
GUnit destUnit)
Converts the units of value to unit.
|
double |
convertToUnit(double value,
GUnit destUnit)
Converts the units of value to unit.
|
String |
getCompactedName()
Returns the name of the unit decomposed in basicUnits, without multipliers and sorted.
|
String |
getName()
Get the string representing the unit name.
|
boolean |
isCompatible(GUnit unit)
Determines if unit is compatible with the GUnit object.
|
boolean |
isValidUnitName(String unitName)
Verify if a unit name string represents a valid unit.
|
public GPercentUnit(String unitName)
unitName
- name of the unit. It must be a valid unit name.public boolean isValidUnitName(String unitName)
isValidUnitName
in interface GUnit
unitName
- unit name string to test.public boolean isCompatible(GUnit unit)
isCompatible
in interface GUnit
unit
- to check if it is compatible.public double convertToUnit(double value, GUnit destUnit) throws GException
convertToUnit
in interface GUnit
value
- to convert.destUnit
- the destination unit.GException
- in case of an error performing the conversion.public double convertToMemory(double value)
convertToMemory
in interface GUnit
value
- to convert.public double convertFromMemory(double value)
convertFromMemory
in interface GUnit
value
- to convert.public String getName()
public String getCompactedName()
getCompactedName
in interface GUnit
public BigDecimal convertToUnit(BigDecimal value, GUnit destUnit) throws GException
convertToUnit
in interface GUnit
value
- to convert.destUnit
- the destination unit.GException
- in case of an error performing the conversion.public BigDecimal convertToMemory(BigDecimal value)
convertToMemory
in interface GUnit
value
- to convert.public BigDecimal convertFromMemory(BigDecimal value)
convertFromMemory
in interface GUnit
value
- to convert.Copyright © 2024. All rights reserved.