diff options
author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2019-04-13 10:05:08 -0400 |
---|---|---|
committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2019-04-13 10:05:08 -0400 |
commit | 8e613844ae19a4dea2089ac34c1f0ae650eaeae7 (patch) | |
tree | 43f3fcf2fc7fafb840156a6fe0a5596ba091a904 /src/org/unitConverter/unit/BaseUnit.java | |
parent | ec036fdad931fbbd7dec28b864150f8668e91b41 (diff) |
The dimension selector now loads dimensions from a file.
The dimension selector does nothing, as its purpose is to filter a
list which does not exist yet, but it does correctly load the options.
Diffstat (limited to 'src/org/unitConverter/unit/BaseUnit.java')
-rwxr-xr-x | src/org/unitConverter/unit/BaseUnit.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/org/unitConverter/unit/BaseUnit.java b/src/org/unitConverter/unit/BaseUnit.java index 643272f..8bac866 100755 --- a/src/org/unitConverter/unit/BaseUnit.java +++ b/src/org/unitConverter/unit/BaseUnit.java @@ -18,11 +18,35 @@ package org.unitConverter.unit; import java.util.Objects; +import org.unitConverter.dimension.StandardDimensions; import org.unitConverter.dimension.UnitDimension; /** * A unit that is the base for its dimension. It does not have to be for a base dimension, so units like the Newton and * Joule are still base units. + * <p> + * {@code BaseUnit} does not have any public constructors or static factories. There are two ways to obtain + * {@code BaseUnit} instances. + * <ol> + * <li>The class {@link SI} in this package has constants for all of the SI base units. You can use these constants and + * multiply or divide them to get other units. For example: + * + * <pre> + * BaseUnit JOULE = SI.KILOGRAM.times(SI.METRE.toExponent(2)).dividedBy(SI.SECOND.toExponent(2)); + * </pre> + * + * </li> + * <li>You can also query a unit system for a base unit using a unit dimension. The previously mentioned {@link SI} + * class can do this for SI and SI-derived units (including imperial and USC), but if you want to use another system, + * this is the way to do it. {@link StandardDimensions} contains common unit dimensions that you can use for this. Here + * is an example: + * + * <pre> + * BaseUnit JOULE = SI.SI.getBaseUnit(StandardDimensions.ENERGY); + * </pre> + * + * </li> + * </ol> * * @author Adrien Hopkins * @since 2018-12-23 |