|
47 | 47 | import org.eclipse.jdt.annotation.Nullable; |
48 | 48 | import org.openhab.core.internal.library.unit.UnitInitializer; |
49 | 49 | import org.openhab.core.items.events.ItemStateEvent; |
| 50 | +import org.openhab.core.library.unit.CurrencyUnits; |
| 51 | +import org.openhab.core.library.unit.ImperialUnits; |
| 52 | +import org.openhab.core.library.unit.SIUnits; |
50 | 53 | import org.openhab.core.library.unit.Units; |
51 | 54 | import org.openhab.core.types.Command; |
52 | 55 | import org.openhab.core.types.PrimitiveType; |
|
62 | 65 | import tech.uom.lib.common.function.QuantityFunctions; |
63 | 66 |
|
64 | 67 | /** |
65 | | - * The measure type extends DecimalType to handle physical unit measurement |
| 68 | + * Command type for measurable quantities, such as: |
| 69 | + * |
| 70 | + * <ul> |
| 71 | + * <li>Mass</li> |
| 72 | + * <li>Time</li> |
| 73 | + * <li>Distance</li> |
| 74 | + * <li>Speed</li> |
| 75 | + * <li>Temperature</li> |
| 76 | + * <li>Electric Current</li> |
| 77 | + * <li>Electric Potential</li> |
| 78 | + * <li>Energy</li> |
| 79 | + * <li>Power</li> |
| 80 | + * <li>Data Amount</li> |
| 81 | + * </ul> |
| 82 | + * |
| 83 | + * <p> |
| 84 | + * Quantities are usually specified in suitable units of measurement. All units are accessible via the openHAB classes |
| 85 | + * {@link Units}, {@link SIUnits}, {@link ImperialUnits} and {@link CurrencyUnits}. |
| 86 | + * |
| 87 | + * <p> |
| 88 | + * Examples: |
| 89 | + * |
| 90 | + * <pre> |
| 91 | + * {@code |
| 92 | + * new QuantityType<>("65 kWh") // 65 kWh, unit is parsed automatically |
| 93 | + * new QuantityType<>(22d, SIUnits.CELSIUS) // 22°C |
| 94 | + * new QuantityType<>(71.6d, ImperialUnits.FAHRENHEIT) // 71.6°F |
| 95 | + * new QuantityType<>(1, MetricPrefix.MEGA(Units.BYTE)) // 1 MB |
| 96 | + * new QuantityType<>(56.78d, Units.WATT_HOUR) // 56.78 Wh |
| 97 | + * } |
| 98 | + * </pre> |
| 99 | + * |
| 100 | + * @param <T> the unit associated with the quantity |
66 | 101 | * |
67 | 102 | * @author Gaël L'hopital - Initial contribution |
68 | 103 | */ |
|
0 commit comments