diff options
Diffstat (limited to 'src/unitConverter/dimension/UnitDimension.java')
-rwxr-xr-x | src/unitConverter/dimension/UnitDimension.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/unitConverter/dimension/UnitDimension.java b/src/unitConverter/dimension/UnitDimension.java index ba2a750..40e5bbc 100755 --- a/src/unitConverter/dimension/UnitDimension.java +++ b/src/unitConverter/dimension/UnitDimension.java @@ -29,12 +29,14 @@ import java.util.Set; *
* @author Adrien Hopkins
* @since 2018-12-11
+ * @since v0.1.0
*/
public final class UnitDimension {
/**
* The unit dimension where every exponent is zero
*
* @since 2018-12-12
+ * @since v0.1.0
*/
public static final UnitDimension EMPTY = new UnitDimension(new HashMap<>());
@@ -45,6 +47,7 @@ public final class UnitDimension { * dimension to get
* @return unit dimension
* @since 2018-12-11
+ * @since v0.1.0
*/
public static final UnitDimension getBase(final BaseDimension dimension) {
final Map<BaseDimension, Integer> map = new HashMap<>();
@@ -56,6 +59,7 @@ public final class UnitDimension { * The base dimensions that make up this dimension.
*
* @since 2018-12-11
+ * @since v0.1.0
*/
final Map<BaseDimension, Integer> exponents;
@@ -65,6 +69,7 @@ public final class UnitDimension { * @param exponents
* base dimensions that make up this dimension
* @since 2018-12-11
+ * @since v0.1.0
*/
private UnitDimension(final Map<BaseDimension, Integer> exponents) {
this.exponents = new HashMap<>(exponents);
@@ -77,6 +82,7 @@ public final class UnitDimension { * other dimension
* @return quotient of two dimensions
* @since 2018-12-11
+ * @since v0.1.0
*/
public UnitDimension dividedBy(final UnitDimension other) {
final Map<BaseDimension, Integer> map = new HashMap<>(this.exponents);
@@ -119,6 +125,7 @@ public final class UnitDimension { /**
* @return a set of all of the base dimensions with non-zero exponents that make up this dimension.
* @since 2018-12-12
+ * @since v0.1.0
*/
public final Set<BaseDimension> getBaseSet() {
final Set<BaseDimension> dimensions = new HashSet<>();
@@ -140,6 +147,7 @@ public final class UnitDimension { * dimension to check
* @return exponent for that dimension
* @since 2018-12-12
+ * @since v0.1.0
*/
public int getExponent(final BaseDimension dimension) {
return this.exponents.getOrDefault(dimension, 0);
@@ -153,6 +161,7 @@ public final class UnitDimension { /**
* @return true if this dimension is a base, i.e. it has one exponent of one and no other nonzero exponents
* @since 2019-01-15
+ * @since v0.1.0
*/
public boolean isBase() {
int oneCount = 0;
@@ -174,6 +183,7 @@ public final class UnitDimension { * other dimension
* @return product of two dimensions
* @since 2018-12-11
+ * @since v0.1.0
*/
public UnitDimension times(final UnitDimension other) {
final Map<BaseDimension, Integer> map = new HashMap<>(this.exponents);
@@ -196,6 +206,7 @@ public final class UnitDimension { * exponent
* @return result of exponientation
* @since 2019-01-15
+ * @since v0.1.0
*/
public UnitDimension toExponent(final int exp) {
final Map<BaseDimension, Integer> map = new HashMap<>(this.exponents);
|