summaryrefslogtreecommitdiff
path: root/src/org/unitConverter/unit/BaseUnit.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/unitConverter/unit/BaseUnit.java')
-rwxr-xr-xsrc/org/unitConverter/unit/BaseUnit.java24
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