public class Unit<Q extends Quantity> extends Object
Modifier and Type | Field and Description |
---|---|
private String |
measurementSystem
The measurement system for the dimension type
|
private Double |
offset
The conversion offset for this unit.
|
private Double |
scaleFactor
The conversion scaling factor for this unit.
|
private String |
symbol
The symbol for this unit.
|
Modifier | Constructor and Description |
---|---|
private |
Unit(String inSystem,
String inSymbol,
Double inScaleFactor,
Double inOffset)
Create a unit.
|
Modifier and Type | Method and Description |
---|---|
Unit<Q> |
add(Double scalar)
Increase the scaling offset in this unit by a scalar.
|
Unit<Q> |
add(Integer scalar)
Increase the scaling offset in this unit by a scalar.
|
Double |
convertValue(Number inValue,
Unit<Q> inUnit)
Convert a value in this unit to the specified unit.
|
static <Q extends Quantity> |
CreateBaseUnit(String inMeasurementSystem,
String inSymbol)
Create the "base unit" for a given measurement system.
|
Unit<Q> |
divide(Double scalar)
Divide the scaling conversion factor in this unit by a scalar.
|
Unit<Q> |
divide(Integer scalar)
Divide the scaling conversion factor in this unit by a scalar.
|
Double |
getOffset()
Get the conversion offset for this unit.
|
Double |
getScaleFactor()
Get the conversion scaling factor for this unit.
|
String |
getSymbol()
Get the symbol for this unit.
|
Boolean |
isConvertible(Unit<Q> inUnit)
Check if this unit is convertible to another unit.
|
Unit<Q> |
multiply(Double scalar)
Multiply the scaling conversion factor in this unit by a scalar.
|
Unit<Q> |
multiply(Integer scalar)
Multiply the scaling conversion factor in this unit by a scalar.
|
Unit<Q> |
prefixSymbol(String prefix)
Add a prefix to the unit symbol in this unit.
|
Unit<Q> |
setSymbol(String inSymbol)
Change the unit symbol in this unit.
|
private final String measurementSystem
private final String symbol
private final Double scaleFactor
private final Double offset
public String getSymbol()
public Double getScaleFactor()
public Double getOffset()
public Boolean isConvertible(Unit<Q> inUnit)
inUnit
- the unit to which to convert.public Double convertValue(Number inValue, Unit<Q> inUnit)
inValue
- the value to convert.inUnit
- the unit to which to convert.ArithmeticException
- if the conversion is not possible.public Unit<Q> multiply(Integer scalar)
scalar
- the multiplication factor.public Unit<Q> multiply(Double scalar)
scalar
- the multiplication factor.public Unit<Q> divide(Integer scalar)
scalar
- the division factor.public Unit<Q> divide(Double scalar)
scalar
- the division factor.public Unit<Q> add(Integer scalar)
scalar
- the value to add.public Unit<Q> add(Double scalar)
scalar
- the value to add.public Unit<Q> setSymbol(String inSymbol)
inSymbol
- the new unit symbol.public Unit<Q> prefixSymbol(String prefix)
prefix
- the unit symbol prefix.public static <Q extends Quantity> Unit<Q> CreateBaseUnit(String inMeasurementSystem, String inSymbol)
inMeasurementSystem
- the name of the measurement system.inSymbol
- the symbol of the base unit.Copyright © 2016 Open Microscopy Environment