Reordered units alphabetical, changed extends on SmartHomeUnits

The classes ImperialUnits and SIUnits both extended SmartHomeUnits. But the classes are used a singletons.

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
This commit is contained in:
Hilbrand Bouwkamp 2019-02-28 16:50:56 +01:00 committed by Markus Rathgeb
parent 58d73f9f5c
commit 21bf4d9ef0
4 changed files with 164 additions and 153 deletions

View File

@ -14,6 +14,7 @@ package org.eclipse.smarthome.core.internal.library.unit;
import org.eclipse.smarthome.core.library.unit.ImperialUnits;
import org.eclipse.smarthome.core.library.unit.SIUnits;
import org.eclipse.smarthome.core.library.unit.SmartHomeUnits;
/**
* Make sure static blocks from {@link SIUnits} & {@link ImperialUnits} are executed to initialize the unit parser.
@ -24,6 +25,7 @@ import org.eclipse.smarthome.core.library.unit.SIUnits;
public class UnitInitializer {
static {
SmartHomeUnits.getInstance();
SIUnits.getInstance();
ImperialUnits.getInstance();
}

View File

@ -23,6 +23,7 @@ import javax.measure.spi.SystemOfUnits;
import org.eclipse.jdt.annotation.NonNullByDefault;
import tec.uom.se.AbstractSystemOfUnits;
import tec.uom.se.format.SimpleUnitFormat;
import tec.uom.se.function.AddConverter;
import tec.uom.se.function.MultiplyConverter;
@ -38,10 +39,62 @@ import tec.uom.se.unit.Units;
*
*/
@NonNullByDefault
public class ImperialUnits extends SmartHomeUnits {
public final class ImperialUnits extends AbstractSystemOfUnits {
private static final ImperialUnits INSTANCE = new ImperialUnits();
/** Additionally defined units to be used in ESH **/
public static final Unit<Pressure> INCH_OF_MERCURY = addUnit(new TransformedUnit<>("inHg", Units.PASCAL,
new RationalConverter(BigInteger.valueOf(3386388), BigInteger.valueOf(1000))));
public static final Unit<Temperature> FAHRENHEIT = addUnit(new TransformedUnit<>("°F", Units.KELVIN,
new RationalConverter(BigInteger.valueOf(5), BigInteger.valueOf(9)).concatenate(new AddConverter(459.67))));
public static final Unit<Speed> MILES_PER_HOUR = addUnit(
new TransformedUnit<>("mph", Units.KILOMETRE_PER_HOUR, new RationalConverter(1609344l, 1000000l)));
/** Length **/
public static final Unit<Length> INCH = addUnit(
new TransformedUnit<>("in", Units.METRE, new RationalConverter(254l, 10000l)));
public static final Unit<Length> FOOT = addUnit(
new TransformedUnit<>("ft", ImperialUnits.INCH, new MultiplyConverter(12.0)));
public static final Unit<Length> YARD = addUnit(
new TransformedUnit<>("yd", ImperialUnits.FOOT, new MultiplyConverter(3.0)));
public static final Unit<Length> CHAIN = addUnit(
new TransformedUnit<>("ch", ImperialUnits.YARD, new MultiplyConverter(22.0)));
public static final Unit<Length> FURLONG = addUnit(
new TransformedUnit<>("fur", ImperialUnits.CHAIN, new MultiplyConverter(10.0)));
public static final Unit<Length> MILE = addUnit(
new TransformedUnit<>("mi", ImperialUnits.FURLONG, new MultiplyConverter(8.0)));
public static final Unit<Length> LEAGUE = addUnit(
new TransformedUnit<>("lea", ImperialUnits.MILE, new MultiplyConverter(3.0)));
public static final Unit<Length> SQUARE_FOOT = addUnit(new ProductUnit<>(FOOT.multiply(FOOT)));
public static final Unit<Length> CUBIC_FOOT = addUnit(new ProductUnit<>(SQUARE_FOOT.multiply(FOOT)));
/**
* Add unit symbols for imperial units.
*/
static {
SimpleUnitFormat.getInstance().label(INCH_OF_MERCURY, INCH_OF_MERCURY.getSymbol());
SimpleUnitFormat.getInstance().label(FAHRENHEIT, FAHRENHEIT.getSymbol());
SimpleUnitFormat.getInstance().label(MILES_PER_HOUR, MILES_PER_HOUR.getSymbol());
SimpleUnitFormat.getInstance().label(INCH, INCH.getSymbol());
SimpleUnitFormat.getInstance().label(FOOT, FOOT.getSymbol());
SimpleUnitFormat.getInstance().label(YARD, YARD.getSymbol());
SimpleUnitFormat.getInstance().label(CHAIN, CHAIN.getSymbol());
SimpleUnitFormat.getInstance().label(FURLONG, FURLONG.getSymbol());
SimpleUnitFormat.getInstance().label(MILE, MILE.getSymbol());
SimpleUnitFormat.getInstance().label(LEAGUE, LEAGUE.getSymbol());
}
private ImperialUnits() {
// avoid external instantiation
}
@ -60,59 +113,6 @@ public class ImperialUnits extends SmartHomeUnits {
return INSTANCE;
}
/** Additionally defined units to be used in ESH **/
public static final Unit<Pressure> INCH_OF_MERCURY = addUnit(new TransformedUnit<>("inHg", Units.PASCAL,
new RationalConverter(BigInteger.valueOf(3386388), BigInteger.valueOf(1000))));
public static final Unit<Temperature> FAHRENHEIT = addUnit(new TransformedUnit<>("°F", Units.KELVIN,
new RationalConverter(BigInteger.valueOf(5), BigInteger.valueOf(9)).concatenate(new AddConverter(459.67))));
public static final Unit<Speed> MILES_PER_HOUR = addUnit(
new TransformedUnit<>("mph", Units.KILOMETRE_PER_HOUR, new RationalConverter(1609344l, 1000000l)));
/** Length **/
public static final Unit<Length> INCH = addUnit(
new TransformedUnit<>("in", Units.METRE, new RationalConverter(254l, 10000l)));
public static final Unit<Length> FOOT = addUnit(
new TransformedUnit<>("ft", ImperialUnits.INCH, new MultiplyConverter(12.0)));
public static final Unit<Length> YARD = addUnit(
new TransformedUnit<>("yd", ImperialUnits.FOOT, new MultiplyConverter(3.0)));
public static final Unit<Length> CHAIN = addUnit(
new TransformedUnit<>("ch", ImperialUnits.YARD, new MultiplyConverter(22.0)));
public static final Unit<Length> FURLONG = addUnit(
new TransformedUnit<>("fur", ImperialUnits.CHAIN, new MultiplyConverter(10.0)));
public static final Unit<Length> MILE = addUnit(
new TransformedUnit<>("mi", ImperialUnits.FURLONG, new MultiplyConverter(8.0)));
public static final Unit<Length> LEAGUE = addUnit(
new TransformedUnit<>("lea", ImperialUnits.MILE, new MultiplyConverter(3.0)));
public static final Unit<Length> SQUARE_FOOT = addUnit(new ProductUnit<>(FOOT.multiply(FOOT)));
public static final Unit<Length> CUBIC_FOOT = addUnit(new ProductUnit<>(SQUARE_FOOT.multiply(FOOT)));
/**
* Add unit symbols for imperial units.
*/
static {
SimpleUnitFormat.getInstance().label(INCH_OF_MERCURY, INCH_OF_MERCURY.getSymbol());
SimpleUnitFormat.getInstance().label(FAHRENHEIT, FAHRENHEIT.getSymbol());
SimpleUnitFormat.getInstance().label(MILES_PER_HOUR, MILES_PER_HOUR.getSymbol());
SimpleUnitFormat.getInstance().label(INCH, INCH.getSymbol());
SimpleUnitFormat.getInstance().label(FOOT, FOOT.getSymbol());
SimpleUnitFormat.getInstance().label(YARD, YARD.getSymbol());
SimpleUnitFormat.getInstance().label(CHAIN, CHAIN.getSymbol());
SimpleUnitFormat.getInstance().label(FURLONG, FURLONG.getSymbol());
SimpleUnitFormat.getInstance().label(MILE, MILE.getSymbol());
SimpleUnitFormat.getInstance().label(LEAGUE, LEAGUE.getSymbol());
}
/**
* Adds a new unit not mapped to any specified quantity type.
*

View File

@ -24,6 +24,7 @@ import javax.measure.spi.SystemOfUnits;
import org.eclipse.jdt.annotation.NonNullByDefault;
import tec.uom.se.AbstractSystemOfUnits;
import tec.uom.se.format.SimpleUnitFormat;
import tec.uom.se.unit.Units;
@ -35,10 +36,19 @@ import tec.uom.se.unit.Units;
*
*/
@NonNullByDefault
public class SIUnits extends SmartHomeUnits {
public final class SIUnits extends AbstractSystemOfUnits {
private static final SIUnits INSTANCE = new SIUnits();
public static final Unit<Temperature> CELSIUS = addUnit(Units.CELSIUS);
public static final Unit<Speed> KILOMETRE_PER_HOUR = addUnit(Units.KILOMETRE_PER_HOUR);
public static final Unit<Length> METRE = addUnit(Units.METRE);
public static final Unit<Mass> KILOGRAM = addUnit(Units.KILOGRAM);
public static final Unit<Mass> GRAM = addUnit(Units.GRAM);
public static final Unit<Area> SQUARE_METRE = addUnit(Units.SQUARE_METRE);
public static final Unit<Volume> CUBIC_METRE = addUnit(Units.CUBIC_METRE);
public static final Unit<Pressure> PASCAL = addUnit(Units.PASCAL);
private SIUnits() {
// avoid external instantiation
}
@ -57,15 +67,6 @@ public class SIUnits extends SmartHomeUnits {
return INSTANCE;
}
public static final Unit<Temperature> CELSIUS = addUnit(Units.CELSIUS);
public static final Unit<Speed> KILOMETRE_PER_HOUR = addUnit(Units.KILOMETRE_PER_HOUR);
public static final Unit<Length> METRE = addUnit(Units.METRE);
public static final Unit<Mass> KILOGRAM = addUnit(Units.KILOGRAM);
public static final Unit<Mass> GRAM = addUnit(Units.GRAM);
public static final Unit<Area> SQUARE_METRE = addUnit(Units.SQUARE_METRE);
public static final Unit<Volume> CUBIC_METRE = addUnit(Units.CUBIC_METRE);
public static final Unit<Pressure> PASCAL = addUnit(Units.PASCAL);
/**
* Adds a new unit not mapped to any specified quantity type.
*

View File

@ -45,6 +45,7 @@ import javax.measure.quantity.Speed;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Time;
import javax.measure.quantity.Volume;
import javax.measure.spi.SystemOfUnits;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.core.library.dimension.ArealDensity;
@ -64,7 +65,7 @@ import tec.uom.se.unit.TransformedUnit;
import tec.uom.se.unit.Units;
/**
* Delegate common units to {@link Units} to hide this dependency from the rest of ESH.
* Delegate common units to {@link Units} to hide this dependency from the rest of openHAB.
* See members of {@link Units} for a detailed description.
* Also: Define common additional units used in {@link SIUnits} and {@link ImperialUnits}.
*
@ -72,90 +73,80 @@ import tec.uom.se.unit.Units;
*
*/
@NonNullByDefault
public class SmartHomeUnits extends AbstractSystemOfUnits {
public final class SmartHomeUnits extends AbstractSystemOfUnits {
private static final SmartHomeUnits INSTANCE = new SmartHomeUnits();
protected SmartHomeUnits() {
// avoid external instantiation
}
@Override
public String getName() {
return SmartHomeUnits.class.getSimpleName();
}
// Alphabetical ordered by Unit.
public static final Unit<Acceleration> METRE_PER_SQUARE_SECOND = addUnit(Units.METRE_PER_SQUARE_SECOND);
public static final Unit<AmountOfSubstance> MOLE = addUnit(Units.MOLE);
public static final Unit<AmountOfSubstance> DEUTSCHE_HAERTE = addUnit(new TransformedUnit<AmountOfSubstance>("°dH",
(Unit<AmountOfSubstance>) MetricPrefix.MILLI(Units.MOLE).divide(Units.LITRE),
RationalConverter.of(5.6, 1)));
public static final Unit<Angle> DEGREE_ANGLE = addUnit(new TransformedUnit<>(Units.RADIAN,
new PiMultiplierConverter().concatenate(new RationalConverter(1, 180))));
/**
* See https://en.wikipedia.org/wiki/Irradiance
*/
public static final Unit<Intensity> IRRADIANCE = addUnit(
new AlternateUnit<Intensity>(Units.WATT.divide(Units.SQUARE_METRE), "W/m2"));
public static final Unit<Intensity> MICROWATT_PER_SQUARE_CENTIMETRE = addUnit(
new TransformedUnit<>(IRRADIANCE, new RationalConverter(BigInteger.valueOf(100), BigInteger.valueOf(1))));
public static final Unit<Speed> MILLIMETRE_PER_HOUR = addUnit(
new TransformedUnit<>("mm/h", Units.KILOMETRE_PER_HOUR, new RationalConverter(1l, 1000000l)));
public static final Unit<Speed> INCHES_PER_HOUR = addUnit(
new TransformedUnit<>("in/h", ImperialUnits.MILES_PER_HOUR, new RationalConverter(1l, 63360l)));
public static final Unit<Dimensionless> ONE = addUnit(AbstractUnit.ONE);
public static final Unit<ElectricCurrent> AMPERE = addUnit(Units.AMPERE);
public static final Unit<LuminousIntensity> CANDELA = addUnit(Units.CANDELA);
public static final Unit<Temperature> KELVIN = addUnit(Units.KELVIN);
public static final Unit<AmountOfSubstance> MOLE = addUnit(Units.MOLE);
public static final Unit<Time> SECOND = addUnit(Units.SECOND);
public static final Unit<Angle> RADIAN = addUnit(Units.RADIAN);
public static final Unit<SolidAngle> STERADIAN = addUnit(Units.STERADIAN);
public static final Unit<Frequency> HERTZ = addUnit(Units.HERTZ);
public static final Unit<Force> NEWTON = addUnit(Units.NEWTON);
public static final Unit<Energy> JOULE = addUnit(Units.JOULE);
public static final Unit<Power> WATT = addUnit(Units.WATT);
public static final Unit<ElectricCharge> COULOMB = addUnit(Units.COULOMB);
public static final Unit<ElectricPotential> VOLT = addUnit(Units.VOLT);
public static final Unit<ElectricCapacitance> FARAD = addUnit(Units.FARAD);
public static final Unit<ElectricResistance> OHM = addUnit(Units.OHM);
public static final Unit<ElectricConductance> SIEMENS = addUnit(Units.SIEMENS);
public static final Unit<MagneticFlux> WEBER = addUnit(Units.WEBER);
public static final Unit<MagneticFluxDensity> TESLA = addUnit(Units.TESLA);
public static final Unit<ElectricInductance> HENRY = addUnit(Units.HENRY);
public static final Unit<LuminousFlux> LUMEN = addUnit(Units.LUMEN);
public static final Unit<Illuminance> LUX = addUnit(Units.LUX);
public static final Unit<Radioactivity> BECQUEREL = addUnit(Units.BECQUEREL);
public static final Unit<RadiationDoseAbsorbed> GRAY = addUnit(Units.GRAY);
public static final Unit<RadiationDoseEffective> SIEVERT = addUnit(Units.SIEVERT);
public static final Unit<ArealDensity> DOBSON_UNIT = addUnit(
new ProductUnit<ArealDensity>(MetricPrefix.MILLI(Units.MOLE).multiply(0.4462).divide(Units.METRE.pow(2))));
public static final Unit<CatalyticActivity> KATAL = addUnit(Units.KATAL);
public static final Unit<Speed> METRE_PER_SECOND = addUnit(Units.METRE_PER_SECOND);
public static final Unit<Speed> KNOT = addUnit(new TransformedUnit<>("kn", Units.KILOMETRE_PER_HOUR,
new RationalConverter(BigInteger.valueOf(1852), BigInteger.valueOf(1000))));
public static final Unit<Acceleration> METRE_PER_SQUARE_SECOND = addUnit(Units.METRE_PER_SQUARE_SECOND);
public static final Unit<Density> KILOGRAM_PER_CUBICMETRE = addUnit(
new ProductUnit<Density>(Units.KILOGRAM.divide(Units.METRE.pow(3))));
public static final Unit<Density> MICROGRAM_PER_CUBICMETRE = addUnit(new TransformedUnit<>(KILOGRAM_PER_CUBICMETRE,
new RationalConverter(BigInteger.valueOf(1), BigInteger.valueOf(1000000000))));
public static final Unit<Dimensionless> ONE = addUnit(AbstractUnit.ONE);
public static final Unit<Dimensionless> PERCENT = addUnit(Units.PERCENT);
public static final Unit<Dimensionless> PARTS_PER_MILLION = addUnit(
new TransformedUnit<>(ONE, new RationalConverter(1, 1000000)));
public static final Unit<Dimensionless> DECIBEL = addUnit(
ONE.transform(new LogConverter(10).inverse().concatenate(RationalConverter.of(1d, 10d))));
public static final Unit<ElectricCurrent> AMPERE = addUnit(Units.AMPERE);
public static final Unit<ElectricCapacitance> FARAD = addUnit(Units.FARAD);
public static final Unit<ElectricCharge> COULOMB = addUnit(Units.COULOMB);
public static final Unit<ElectricConductance> SIEMENS = addUnit(Units.SIEMENS);
public static final Unit<ElectricInductance> HENRY = addUnit(Units.HENRY);
public static final Unit<ElectricPotential> VOLT = addUnit(Units.VOLT);
public static final Unit<ElectricResistance> OHM = addUnit(Units.OHM);
public static final Unit<Energy> JOULE = addUnit(Units.JOULE);
public static final Unit<Energy> WATT_SECOND = addUnit(new ProductUnit<Energy>(Units.WATT.multiply(Units.SECOND)));
public static final Unit<Energy> WATT_HOUR = addUnit(new ProductUnit<Energy>(Units.WATT.multiply(Units.HOUR)));
public static final Unit<Energy> KILOWATT_HOUR = addUnit(MetricPrefix.KILO(WATT_HOUR));
public static final Unit<Energy> MEGAWATT_HOUR = addUnit(MetricPrefix.MEGA(WATT_HOUR));
public static final Unit<Force> NEWTON = addUnit(Units.NEWTON);
public static final Unit<Frequency> HERTZ = addUnit(Units.HERTZ);
public static final Unit<Intensity> IRRADIANCE = addUnit(
new AlternateUnit<Intensity>(Units.WATT.divide(Units.SQUARE_METRE), "W/m2"));
public static final Unit<Intensity> MICROWATT_PER_SQUARE_CENTIMETRE = addUnit(
new TransformedUnit<>(IRRADIANCE, new RationalConverter(BigInteger.valueOf(100), BigInteger.valueOf(1))));
public static final Unit<Illuminance> LUX = addUnit(Units.LUX);
public static final Unit<LuminousFlux> LUMEN = addUnit(Units.LUMEN);
public static final Unit<LuminousIntensity> CANDELA = addUnit(Units.CANDELA);
public static final Unit<MagneticFlux> WEBER = addUnit(Units.WEBER);
public static final Unit<MagneticFluxDensity> TESLA = addUnit(Units.TESLA);
public static final Unit<Power> WATT = addUnit(Units.WATT);
public static final Unit<Pressure> MILLIMETRE_OF_MERCURY = addUnit(new TransformedUnit<>("mmHg", Units.PASCAL,
new RationalConverter(BigInteger.valueOf(133322368), BigInteger.valueOf(1000000))));
public static final Unit<Pressure> BAR = addUnit(new TransformedUnit<>("bar", Units.PASCAL,
new RationalConverter(BigInteger.valueOf(100000), BigInteger.valueOf(1))));
public static final Unit<Pressure> MILLIBAR = addUnit(MetricPrefix.MILLI(BAR));
public static final Unit<Radioactivity> BECQUEREL = addUnit(Units.BECQUEREL);
public static final Unit<RadiationDoseAbsorbed> GRAY = addUnit(Units.GRAY);
public static final Unit<RadiationDoseEffective> SIEVERT = addUnit(Units.SIEVERT);
public static final Unit<Speed> MILLIMETRE_PER_HOUR = addUnit(
new TransformedUnit<>("mm/h", Units.KILOMETRE_PER_HOUR, new RationalConverter(1l, 1000000l)));
public static final Unit<Speed> INCHES_PER_HOUR = addUnit(
new TransformedUnit<>("in/h", ImperialUnits.MILES_PER_HOUR, new RationalConverter(1l, 63360l)));
public static final Unit<Speed> METRE_PER_SECOND = addUnit(Units.METRE_PER_SECOND);
public static final Unit<Speed> KNOT = addUnit(new TransformedUnit<>("kn", Units.KILOMETRE_PER_HOUR,
new RationalConverter(BigInteger.valueOf(1852), BigInteger.valueOf(1000))));
public static final Unit<SolidAngle> STERADIAN = addUnit(Units.STERADIAN);
public static final Unit<Temperature> KELVIN = addUnit(Units.KELVIN);
public static final Unit<Time> SECOND = addUnit(Units.SECOND);
public static final Unit<Time> MINUTE = addUnit(Units.MINUTE);
public static final Unit<Time> HOUR = addUnit(Units.HOUR);
public static final Unit<Time> DAY = addUnit(Units.DAY);
public static final Unit<Time> WEEK = addUnit(Units.WEEK);
public static final Unit<Time> YEAR = addUnit(Units.YEAR);
public static final Unit<Volume> LITRE = addUnit(Units.LITRE);
public static final Unit<Density> KILOGRAM_PER_CUBICMETRE = addUnit(
new ProductUnit<Density>(Units.KILOGRAM.divide(Units.METRE.pow(3))));
public static final Unit<Density> MICROGRAM_PER_CUBICMETRE = addUnit(new TransformedUnit<>(KILOGRAM_PER_CUBICMETRE,
new RationalConverter(BigInteger.valueOf(1), BigInteger.valueOf(1000000000))));
public static final Unit<Energy> WATT_SECOND = addUnit(new ProductUnit<Energy>(Units.WATT.multiply(Units.SECOND)));
public static final Unit<Energy> WATT_HOUR = addUnit(new ProductUnit<Energy>(Units.WATT.multiply(Units.HOUR)));
public static final Unit<Energy> KILOWATT_HOUR = addUnit(MetricPrefix.KILO(WATT_HOUR));
public static final Unit<Energy> MEGAWATT_HOUR = addUnit(MetricPrefix.MEGA(WATT_HOUR));
public static final Unit<Pressure> MILLIMETRE_OF_MERCURY = addUnit(new TransformedUnit<>("mmHg", Units.PASCAL,
new RationalConverter(BigInteger.valueOf(133322368), BigInteger.valueOf(1000000))));
public static final Unit<Pressure> BAR = addUnit(new TransformedUnit<>("bar", Units.PASCAL,
new RationalConverter(BigInteger.valueOf(100000), BigInteger.valueOf(1))));
public static final Unit<Pressure> MILLIBAR = addUnit(MetricPrefix.MILLI(BAR));
public static final Unit<ArealDensity> DOBSON_UNIT = addUnit(
new ProductUnit<ArealDensity>(MetricPrefix.MILLI(Units.MOLE).multiply(0.4462).divide(Units.METRE.pow(2))));
public static final Unit<VolumetricFlowRate> LITRE_PER_MINUTE = addUnit(
new ProductUnit<VolumetricFlowRate>(Units.LITRE.divide(Units.MINUTE)));
public static final Unit<VolumetricFlowRate> CUBICMETRE_PER_SECOND = addUnit(
@ -166,34 +157,51 @@ public class SmartHomeUnits extends AbstractSystemOfUnits {
new ProductUnit<VolumetricFlowRate>(Units.CUBIC_METRE.divide(Units.HOUR)));
public static final Unit<VolumetricFlowRate> CUBICMETRE_PER_DAY = addUnit(
new ProductUnit<VolumetricFlowRate>(Units.CUBIC_METRE.divide(Units.DAY)));
public static final Unit<AmountOfSubstance> DEUTSCHE_HAERTE = addUnit(new TransformedUnit<AmountOfSubstance>("°dH",
(Unit<AmountOfSubstance>) MetricPrefix.MILLI(Units.MOLE).divide(Units.LITRE),
RationalConverter.of(5.6, 1)));
/**
* Add unit symbols for custom ESH units.
* Add unit symbols for custom openHAB units.
*/
static {
SimpleUnitFormat.getInstance().label(PARTS_PER_MILLION, "ppm");
SimpleUnitFormat.getInstance().label(DECIBEL, "dB");
SimpleUnitFormat.getInstance().label(IRRADIANCE, "W/m²");
SimpleUnitFormat.getInstance().label(MICROWATT_PER_SQUARE_CENTIMETRE, "µW/cm²");
SimpleUnitFormat.getInstance().label(DEGREE_ANGLE, "°");
SimpleUnitFormat.getInstance().label(MICROGRAM_PER_CUBICMETRE, "µg/m³");
SimpleUnitFormat.getInstance().label(WATT_SECOND, "Ws");
SimpleUnitFormat.getInstance().label(WATT_HOUR, "Wh");
SimpleUnitFormat.getInstance().label(KILOWATT_HOUR, "kWh");
SimpleUnitFormat.getInstance().label(MEGAWATT_HOUR, "MWh");
SimpleUnitFormat.getInstance().label(MILLIMETRE_OF_MERCURY, MILLIMETRE_OF_MERCURY.getSymbol());
// Ordered alphabetical by name
SimpleUnitFormat.getInstance().label(BAR, BAR.getSymbol());
SimpleUnitFormat.getInstance().label(MILLIBAR, "mbar");
SimpleUnitFormat.getInstance().label(KNOT, KNOT.getSymbol());
SimpleUnitFormat.getInstance().label(DOBSON_UNIT, "DU");
SimpleUnitFormat.getInstance().label(LITRE_PER_MINUTE, "l/min");
SimpleUnitFormat.getInstance().label(CUBICMETRE_PER_SECOND, "m³/s");
SimpleUnitFormat.getInstance().label(CUBICMETRE_PER_MINUTE, "m³/min");
SimpleUnitFormat.getInstance().label(CUBICMETRE_PER_HOUR, "m³/h");
SimpleUnitFormat.getInstance().label(CUBICMETRE_PER_DAY, "m³/d");
SimpleUnitFormat.getInstance().label(CUBICMETRE_PER_HOUR, "m³/h");
SimpleUnitFormat.getInstance().label(CUBICMETRE_PER_MINUTE, "m³/min");
SimpleUnitFormat.getInstance().label(CUBICMETRE_PER_SECOND, "m³/s");
SimpleUnitFormat.getInstance().label(DECIBEL, "dB");
SimpleUnitFormat.getInstance().label(DEGREE_ANGLE, "°");
SimpleUnitFormat.getInstance().label(DEUTSCHE_HAERTE, "°dH");
SimpleUnitFormat.getInstance().label(DOBSON_UNIT, "DU");
SimpleUnitFormat.getInstance().label(IRRADIANCE, "W/m²");
SimpleUnitFormat.getInstance().label(KILOWATT_HOUR, "kWh");
SimpleUnitFormat.getInstance().label(KNOT, KNOT.getSymbol());
SimpleUnitFormat.getInstance().label(LITRE_PER_MINUTE, "l/min");
SimpleUnitFormat.getInstance().label(MEGAWATT_HOUR, "MWh");
SimpleUnitFormat.getInstance().label(MICROGRAM_PER_CUBICMETRE, "µg/m³");
SimpleUnitFormat.getInstance().label(MICROWATT_PER_SQUARE_CENTIMETRE, "µW/cm²");
SimpleUnitFormat.getInstance().label(MILLIBAR, "mbar");
SimpleUnitFormat.getInstance().label(MILLIMETRE_OF_MERCURY, MILLIMETRE_OF_MERCURY.getSymbol());
SimpleUnitFormat.getInstance().label(PARTS_PER_MILLION, "ppm");
SimpleUnitFormat.getInstance().label(WATT_HOUR, "Wh");
SimpleUnitFormat.getInstance().label(WATT_SECOND, "Ws");
}
private SmartHomeUnits() {
// avoid external instantiation
}
@Override
public String getName() {
return SmartHomeUnits.class.getSimpleName();
}
/**
* Returns the unique instance of this class.
*
* @return the Units instance.
*/
public static SystemOfUnits getInstance() {
return INSTANCE;
}
/**