summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/unit/UnitValue.java
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2024-03-24 13:14:11 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2024-03-24 13:14:11 -0500
commit26291e672b0e683edc9d57710a9a9d96ca199c45 (patch)
treedf88f3d3f110e50f38b8a2752d55df4a0c777677 /src/main/java/sevenUnits/unit/UnitValue.java
parentcc45a65c78c578eb404d8773b22e5b046917621f (diff)
Format source code & set explicit UTF-8
Diffstat (limited to 'src/main/java/sevenUnits/unit/UnitValue.java')
-rw-r--r--src/main/java/sevenUnits/unit/UnitValue.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/sevenUnits/unit/UnitValue.java b/src/main/java/sevenUnits/unit/UnitValue.java
index 339263d..2d01831 100644
--- a/src/main/java/sevenUnits/unit/UnitValue.java
+++ b/src/main/java/sevenUnits/unit/UnitValue.java
@@ -42,10 +42,10 @@ public final class UnitValue {
return new UnitValue(
Objects.requireNonNull(unit, "unit must not be null"), value);
}
-
+
private final Unit unit;
private final double value;
-
+
/**
* @param unit the unit being used
* @param value the value being represented
@@ -54,7 +54,7 @@ public final class UnitValue {
this.unit = unit;
this.value = value;
}
-
+
/**
* @return true if this value can be converted to {@code other}.
* @since 2020-10-01
@@ -62,7 +62,7 @@ public final class UnitValue {
public final boolean canConvertTo(Unit other) {
return this.unit.canConvertTo(other);
}
-
+
/**
* @return true if this value can be converted to {@code other}.
* @since 2020-10-01
@@ -70,7 +70,7 @@ public final class UnitValue {
public final <W> boolean canConvertTo(Unitlike<W> other) {
return this.unit.canConvertTo(other);
}
-
+
/**
* Returns a UnitlikeValue that represents the same value expressed in a
* different unitlike form.
@@ -83,7 +83,7 @@ public final class UnitValue {
return UnitlikeValue.of(other,
this.unit.convertTo(other, this.getValue()));
}
-
+
/**
* Returns a UnitValue that represents the same value expressed in a
* different unit
@@ -95,7 +95,7 @@ public final class UnitValue {
return UnitValue.of(other,
this.getUnit().convertTo(other, this.getValue()));
}
-
+
/**
* Returns this unit value represented as a {@code LinearUnitValue} with this
* unit's base unit as the base.
@@ -108,7 +108,7 @@ public final class UnitValue {
final LinearUnit base = LinearUnit.getBase(this.unit).withName(ns);
return this.convertToLinear(base);
}
-
+
/**
* @return a {@code LinearUnitValue} that is equivalent to this value. It
* will have zero uncertainty.
@@ -118,7 +118,7 @@ public final class UnitValue {
return LinearUnitValue.getExact(other,
this.getUnit().convertTo(other, this.getValue()));
}
-
+
/**
* Returns true if this and obj represent the same value, regardless of
* whether or not they are expressed in the same unit. So (1000 m).equals(1
@@ -135,7 +135,7 @@ public final class UnitValue {
.doubleToLongBits(
other.getUnit().convertToBase(other.getValue()));
}
-
+
/**
* @return the unit
* @since 2020-09-29
@@ -143,7 +143,7 @@ public final class UnitValue {
public final Unit getUnit() {
return this.unit;
}
-
+
/**
* @return the value
* @since 2020-09-29
@@ -151,13 +151,13 @@ public final class UnitValue {
public final double getValue() {
return this.value;
}
-
+
@Override
public int hashCode() {
return Objects.hash(this.getUnit().getBase(),
this.getUnit().convertFromBase(this.getValue()));
}
-
+
@Override
public String toString() {
final Optional<String> primaryName = this.getUnit().getPrimaryName();