summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/unit
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/sevenUnits/unit')
-rw-r--r--src/main/java/sevenUnits/unit/BaseUnit.java7
-rw-r--r--src/main/java/sevenUnits/unit/BritishImperial.java8
-rw-r--r--src/main/java/sevenUnits/unit/FunctionalUnit.java1
-rw-r--r--src/main/java/sevenUnits/unit/LinearUnit.java6
-rw-r--r--src/main/java/sevenUnits/unit/LinearUnitValue.java94
-rw-r--r--src/main/java/sevenUnits/unit/LoadingException.java59
-rw-r--r--src/main/java/sevenUnits/unit/Metric.java3
-rw-r--r--src/main/java/sevenUnits/unit/USCustomary.java3
-rw-r--r--src/main/java/sevenUnits/unit/Unit.java4
-rw-r--r--src/main/java/sevenUnits/unit/UnitDatabase.java16
-rw-r--r--src/main/java/sevenUnits/unit/UnitPrefix.java5
-rw-r--r--src/main/java/sevenUnits/unit/UnitType.java7
-rw-r--r--src/main/java/sevenUnits/unit/UnitValue.java11
13 files changed, 159 insertions, 65 deletions
diff --git a/src/main/java/sevenUnits/unit/BaseUnit.java b/src/main/java/sevenUnits/unit/BaseUnit.java
index fe85a7b..4781be9 100644
--- a/src/main/java/sevenUnits/unit/BaseUnit.java
+++ b/src/main/java/sevenUnits/unit/BaseUnit.java
@@ -50,9 +50,10 @@ public final class BaseUnit extends Unit {
/**
* Gets a base unit from the dimension it measures, its name and its symbol.
*
- * @param dimension dimension measured by this unit
- * @param name name of unit
- * @param symbol symbol of unit
+ * @param dimension dimension measured by this unit
+ * @param name name of unit
+ * @param symbol symbol of unit
+ * @param otherNames other possible names of unit
* @return base unit
* @since 2019-10-21
*/
diff --git a/src/main/java/sevenUnits/unit/BritishImperial.java b/src/main/java/sevenUnits/unit/BritishImperial.java
index 69a3c05..16255da 100644
--- a/src/main/java/sevenUnits/unit/BritishImperial.java
+++ b/src/main/java/sevenUnits/unit/BritishImperial.java
@@ -24,6 +24,9 @@ import sevenUnits.utils.NameSymbol;
* @author Adrien Hopkins
* @since 2019-10-21
*/
+// this class is just constants, most of which are obvious from the variable name
+// so no need to check for missing values
+@SuppressWarnings("javadoc")
public final class BritishImperial {
/**
* Imperial units that measure area
@@ -55,11 +58,16 @@ public final class BritishImperial {
public static final LinearUnit FOOT = YARD.dividedBy(3);
public static final LinearUnit INCH = FOOT.dividedBy(12);
public static final LinearUnit THOU = INCH.dividedBy(1000);
+ /** A chain, equal to 22 yards. */
public static final LinearUnit CHAIN = YARD.times(22);
+ /** A furlong, equal to 10 chains or 220 yards. */
public static final LinearUnit FURLONG = CHAIN.times(10);
+ /** A mile, equal to 8 furlongs or 1760 yards. */
public static final LinearUnit MILE = FURLONG.times(8);
+ /** A league, equal to 3 miles. */
public static final LinearUnit LEAGUE = MILE.times(3);
+ /** A nautical mile, around 1 arcminute around the Earth's circumference. */
public static final LinearUnit NAUTICAL_MILE = Metric.METRE.times(1852);
public static final LinearUnit CABLE = NAUTICAL_MILE.dividedBy(10);
public static final LinearUnit FATHOM = CABLE.dividedBy(100);
diff --git a/src/main/java/sevenUnits/unit/FunctionalUnit.java b/src/main/java/sevenUnits/unit/FunctionalUnit.java
index 6de446f..8ca87b3 100644
--- a/src/main/java/sevenUnits/unit/FunctionalUnit.java
+++ b/src/main/java/sevenUnits/unit/FunctionalUnit.java
@@ -74,6 +74,7 @@ final class FunctionalUnit extends Unit {
* base and returns that value expressed in this unit.
* @param converterTo function that accepts a value expressed in the unit
* and returns that value expressed in the unit's base.
+ * @param ns name and symbol of resulting unit
* @throws NullPointerException if any argument is null
* @since 2019-05-22
*/
diff --git a/src/main/java/sevenUnits/unit/LinearUnit.java b/src/main/java/sevenUnits/unit/LinearUnit.java
index d453a43..99bea96 100644
--- a/src/main/java/sevenUnits/unit/LinearUnit.java
+++ b/src/main/java/sevenUnits/unit/LinearUnit.java
@@ -66,6 +66,7 @@ public final class LinearUnit extends Unit {
}
/**
+ * @param unit unit to get base version of
* @return the base unit associated with {@code unit}, as a
* {@code LinearUnit}.
* @since 2020-10-02
@@ -232,6 +233,7 @@ public final class LinearUnit extends Unit {
}
/**
+ * @param other unit to test equality with
* @return true iff this unit and other are equal,
* ignoring small differences caused by floating-point error.
*
@@ -397,7 +399,9 @@ public final class LinearUnit extends Unit {
/**
* Returns this unit to an exponent, rounding the resulting dimensions to the
* nearest integer.
- *
+ *
+ * @param exponent exponent to raise unit to
+ * @return result of rounded exponentation
* @since 2024-08-22
* @see ObjectProduct#toExponentRounded
*/
diff --git a/src/main/java/sevenUnits/unit/LinearUnitValue.java b/src/main/java/sevenUnits/unit/LinearUnitValue.java
index 678c59c..e4cc820 100644
--- a/src/main/java/sevenUnits/unit/LinearUnitValue.java
+++ b/src/main/java/sevenUnits/unit/LinearUnitValue.java
@@ -36,8 +36,9 @@ import sevenUnits.utils.UncertainDouble;
* @since 2020-07-26
*/
public final class LinearUnitValue {
+ /** The value 1 as a LinearUnitValue. */
public static final LinearUnitValue ONE = getExact(Metric.ONE, 1);
-
+
/**
* Gets an exact {@code LinearUnitValue}
*
@@ -52,12 +53,12 @@ public final class LinearUnitValue {
Objects.requireNonNull(unit, "unit must not be null"),
UncertainDouble.of(value, 0));
}
-
+
/**
* Gets an uncertain {@code LinearUnitValue}
*
- * @param unit unit to express with
- * @param value value to express
+ * @param unit unit to express with
+ * @param value value to express
* @return uncertain {@code LinearUnitValue} instance
* @since 2020-07-26
*/
@@ -67,11 +68,11 @@ public final class LinearUnitValue {
Objects.requireNonNull(unit, "unit must not be null"),
Objects.requireNonNull(value, "value may not be null"));
}
-
+
private final LinearUnit unit;
-
+
private final UncertainDouble value;
-
+
/**
* @param unit unit to express as
* @param value value to express
@@ -81,7 +82,7 @@ public final class LinearUnitValue {
this.unit = unit;
this.value = value;
}
-
+
/**
* @return this value as a {@code UnitValue}. All uncertainty information is
* removed from the returned value.
@@ -90,7 +91,7 @@ public final class LinearUnitValue {
public final UnitValue asUnitValue() {
return UnitValue.of(this.unit, this.value.value());
}
-
+
/**
* @param other a {@code LinearUnit}
* @return true iff this value can be represented with {@code other}.
@@ -99,7 +100,7 @@ public final class LinearUnitValue {
public final boolean canConvertTo(final LinearUnit other) {
return this.unit.canConvertTo(other);
}
-
+
/**
* Returns a LinearUnitValue that represents the same value expressed in a
* different unit
@@ -111,12 +112,13 @@ public final class LinearUnitValue {
public final LinearUnitValue convertTo(final LinearUnit other) {
return LinearUnitValue.of(other, this.unit.convertTo(other, this.value));
}
-
+
/**
* Convert a LinearUnitValue to a sum of multiple units, where all but the
* last have exact integer values.
*
* @param others units to convert to
+ * @return terms of the sum
* @throws IllegalArgumentException if no units are provided or units
* provided have incompatible bases
* @since 2024-08-15
@@ -130,7 +132,7 @@ public final class LinearUnitValue {
throw new IllegalArgumentException(
"All provided units must have the same base as the value.");
}
-
+
LinearUnitValue remaining = this;
final List<LinearUnitValue> values = new ArrayList<>(others.size());
for (final LinearUnit unit : others.subList(0, others.size() - 1)) {
@@ -140,13 +142,13 @@ public final class LinearUnitValue {
values.add(value);
remaining = remaining.minus(value);
}
-
+
final LinearUnitValue lastValue = remaining
.convertTo(others.get(others.size() - 1));
values.add(lastValue);
return values;
}
-
+
/**
* Divides this value by a scalar
*
@@ -157,7 +159,7 @@ public final class LinearUnitValue {
public LinearUnitValue dividedBy(final double divisor) {
return LinearUnitValue.of(this.unit, this.value.dividedByExact(divisor));
}
-
+
/**
* Divides this value by another value
*
@@ -169,7 +171,7 @@ public final class LinearUnitValue {
return LinearUnitValue.of(this.unit.dividedBy(divisor.unit),
this.value.dividedBy(divisor.value));
}
-
+
/**
* 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
@@ -187,14 +189,17 @@ public final class LinearUnitValue {
&& this.unit.convertToBase(this.value)
.equals(other.unit.convertToBase(other.value));
}
-
+
/**
* 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
* km) returns true.
- * <p>
- * If avoidFPErrors is true, this method will attempt to avoid floating-point
- * errors, at the cost of not always being transitive.
+ *
+ * @param obj object to test equality with
+ * @param avoidFPErrors if true, this method will attempt to avoid
+ * floating-point errors, at the cost of not always
+ * being transitive.
+ * @return true iff this and obj are equal
*
* @since 2020-07-28
*/
@@ -208,7 +213,7 @@ public final class LinearUnitValue {
&& DecimalComparison.equals(this.unit.convertToBase(this.value),
other.unit.convertToBase(other.value));
}
-
+
/**
* @param other another {@code LinearUnitValue}
* @return true iff this and other are within each other's uncertainty range
@@ -222,10 +227,10 @@ public final class LinearUnitValue {
final LinearUnit base = LinearUnit.valueOf(this.unit.getBase(), 1);
final LinearUnitValue thisBase = this.convertTo(base);
final LinearUnitValue otherBase = other.convertTo(base);
-
+
return thisBase.value.equivalent(otherBase.value);
}
-
+
/**
* @return the unit
* @since 2020-09-29
@@ -233,7 +238,7 @@ public final class LinearUnitValue {
public final LinearUnit getUnit() {
return this.unit;
}
-
+
/**
* @return the value
* @since 2020-09-29
@@ -241,7 +246,7 @@ public final class LinearUnitValue {
public final UncertainDouble getValue() {
return this.value;
}
-
+
/**
* @return the exact value
* @since 2020-09-07
@@ -249,13 +254,13 @@ public final class LinearUnitValue {
public final double getValueExact() {
return this.value.value();
}
-
+
@Override
public int hashCode() {
return Objects.hash(this.unit.getBase(),
this.unit.convertToBase(this.getValue()));
}
-
+
/**
* Returns the difference of this value and another, expressed in this
* value's unit
@@ -268,17 +273,17 @@ public final class LinearUnitValue {
*/
public LinearUnitValue minus(final LinearUnitValue subtrahend) {
Objects.requireNonNull(subtrahend, "subtrahend may not be null");
-
+
if (!this.canConvertTo(subtrahend.unit))
throw new IllegalArgumentException(String.format(
"Incompatible units for subtraction \"%s\" and \"%s\".",
this.unit, subtrahend.unit));
-
+
final LinearUnitValue otherConverted = subtrahend.convertTo(this.unit);
return LinearUnitValue.of(this.unit,
this.value.minus(otherConverted.value));
}
-
+
/**
* Returns the sum of this value and another, expressed in this value's unit
*
@@ -290,17 +295,17 @@ public final class LinearUnitValue {
*/
public LinearUnitValue plus(final LinearUnitValue addend) {
Objects.requireNonNull(addend, "addend may not be null");
-
+
if (!this.canConvertTo(addend.unit))
throw new IllegalArgumentException(String.format(
"Incompatible units for addition \"%s\" and \"%s\".", this.unit,
addend.unit));
-
+
final LinearUnitValue otherConverted = addend.convertTo(this.unit);
return LinearUnitValue.of(this.unit,
this.value.plus(otherConverted.value));
}
-
+
/**
* Multiplies this value by a scalar
*
@@ -311,7 +316,7 @@ public final class LinearUnitValue {
public LinearUnitValue times(final double multiplier) {
return LinearUnitValue.of(this.unit, this.value.timesExact(multiplier));
}
-
+
/**
* Multiplies this value by another value
*
@@ -323,7 +328,7 @@ public final class LinearUnitValue {
return LinearUnitValue.of(this.unit.times(multiplier.unit),
this.value.times(multiplier.value));
}
-
+
/**
* Raises a value to an exponent
*
@@ -335,9 +340,12 @@ public final class LinearUnitValue {
return LinearUnitValue.of(this.unit.toExponent(exponent),
this.value.toExponentExact(exponent));
}
-
+
/**
* Raises this value to an exponent, rounding all dimensions to integers.
+ *
+ * @param exponent exponent to raise this value to
+ * @return result of exponentation
*
* @since 2024-08-22
* @see ObjectProduct#toExponentRounded
@@ -346,12 +354,12 @@ public final class LinearUnitValue {
return LinearUnitValue.of(this.unit.toExponentRounded(exponent),
this.value.toExponentExact(exponent));
}
-
+
@Override
public String toString() {
return this.toString(!this.value.isExact(), RoundingMode.HALF_EVEN);
}
-
+
/**
* Returns a string representing the object. <br>
* If the attached unit has a name or symbol, the string looks like "12 km".
@@ -362,6 +370,10 @@ public final class LinearUnitValue {
* <p>
* Non-exact values are rounded intelligently based on their uncertainty.
*
+ * @param showUncertainty whether to show the value's uncertainty
+ * @param roundingMode how to round numbers in this string
+ * @return string representing this value
+ *
* @since 2020-07-26
*/
public String toString(final boolean showUncertainty,
@@ -369,9 +381,9 @@ public final class LinearUnitValue {
final Optional<String> primaryName = this.unit.getPrimaryName();
final Optional<String> symbol = this.unit.getSymbol();
final String chosenName = symbol.orElse(primaryName.orElse(null));
-
+
final UncertainDouble baseValue = this.unit.convertToBase(this.value);
-
+
// get rounded strings
// if showUncertainty is true, add brackets around the string
final String valueString = (showUncertainty ? "(" : "")
@@ -380,7 +392,7 @@ public final class LinearUnitValue {
final String baseValueString = (showUncertainty ? "(" : "")
+ baseValue.toString(showUncertainty, roundingMode)
+ (showUncertainty ? ")" : "");
-
+
// create string
if (chosenName == null)
return String.format("%s unnamed unit (= %s %s)", valueString,
diff --git a/src/main/java/sevenUnits/unit/LoadingException.java b/src/main/java/sevenUnits/unit/LoadingException.java
index 9376ed7..18630a4 100644
--- a/src/main/java/sevenUnits/unit/LoadingException.java
+++ b/src/main/java/sevenUnits/unit/LoadingException.java
@@ -27,20 +27,29 @@ import java.util.Optional;
* @since 2024-08-22
*/
public final class LoadingException extends RuntimeException {
+ /** The type of file that was being loaded. */
public static enum FileType {
- UNIT, DIMENSION
+ @SuppressWarnings("javadoc") UNIT, @SuppressWarnings("javadoc") DIMENSION
}
-
+
private static final long serialVersionUID = -8167971828216907607L;
-
+
private final long lineNumber;
private final String line;
private final Optional<Path> file;
-
+
private final FileType fileType;
-
+
private final RuntimeException problem;
-
+
+ /**
+ * Create a LoadingException from some information, without a file.
+ *
+ * @param lineNumber line number error happened on
+ * @param line text of invalid line
+ * @param fileType type of file
+ * @param problem problem, as an Exception
+ */
public LoadingException(long lineNumber, String line, FileType fileType,
RuntimeException problem) {
super(problem);
@@ -50,7 +59,16 @@ public final class LoadingException extends RuntimeException {
this.fileType = fileType;
this.problem = problem;
}
-
+
+ /**
+ * Create a LoadingException from some information, with a file.
+ *
+ * @param lineNumber line number error happened on
+ * @param line text of invalid line
+ * @param file file error happened on
+ * @param fileType type of file
+ * @param problem problem, as an Exception
+ */
public LoadingException(long lineNumber, String line, Path file,
FileType fileType, RuntimeException problem) {
super(problem);
@@ -60,15 +78,21 @@ public final class LoadingException extends RuntimeException {
this.fileType = fileType;
this.problem = problem;
}
-
+
+ /**
+ * @return the file this error happened in, if there is one
+ */
public Optional<Path> file() {
return this.file;
}
-
+
+ /**
+ * @return type of file that this error happened in
+ */
public FileType fileType() {
return this.fileType;
}
-
+
@Override
public String getMessage() {
return this.file
@@ -81,15 +105,24 @@ public final class LoadingException extends RuntimeException {
this.lineNumber, this.fileType.toString().toLowerCase(),
this.line, this.problem));
}
-
+
+ /**
+ * @return text of line that caused this error
+ */
public String line() {
return this.line;
}
-
+
+ /**
+ * @return number of line that caused this error
+ */
public long lineNumber() {
return this.lineNumber;
}
-
+
+ /**
+ * @return the error, as an exception
+ */
public RuntimeException problem() {
return this.problem;
}
diff --git a/src/main/java/sevenUnits/unit/Metric.java b/src/main/java/sevenUnits/unit/Metric.java
index 2fc3928..16859bf 100644
--- a/src/main/java/sevenUnits/unit/Metric.java
+++ b/src/main/java/sevenUnits/unit/Metric.java
@@ -37,6 +37,9 @@ import sevenUnits.utils.ObjectProduct;
* @author Adrien Hopkins
* @since 2019-10-16
*/
+// this class is just constants, most of which are obvious from the variable name
+// so no need to check for missing values
+@SuppressWarnings("javadoc")
public final class Metric {
/// dimensions used by SI units
// base dimensions, as BaseDimensions
diff --git a/src/main/java/sevenUnits/unit/USCustomary.java b/src/main/java/sevenUnits/unit/USCustomary.java
index fce829e..fa3f26e 100644
--- a/src/main/java/sevenUnits/unit/USCustomary.java
+++ b/src/main/java/sevenUnits/unit/USCustomary.java
@@ -22,6 +22,9 @@ package sevenUnits.unit;
* @author Adrien Hopkins
* @since 2019-10-21
*/
+// this class is just constants, most of which are obvious from the variable name
+// so no need to check for missing values
+@SuppressWarnings("javadoc")
public final class USCustomary {
/**
* US Customary units that measure area
diff --git a/src/main/java/sevenUnits/unit/Unit.java b/src/main/java/sevenUnits/unit/Unit.java
index d25b362..61a5dbf 100644
--- a/src/main/java/sevenUnits/unit/Unit.java
+++ b/src/main/java/sevenUnits/unit/Unit.java
@@ -262,7 +262,7 @@ public abstract class Unit implements Nameable {
}
/**
- * Returns true iff this unit is metric.
+ * Determines whether this unit is metric.
* <p>
* "Metric" is defined by three conditions:
* <ul>
@@ -278,6 +278,8 @@ public abstract class Unit implements Nameable {
* All SI units (as designated by the BIPM) except the degree Celsius are
* considered "metric" by this definition.
*
+ * @return true iff this unit is metric.
+ *
* @since 2020-08-27
*/
public final boolean isMetric() {
diff --git a/src/main/java/sevenUnits/unit/UnitDatabase.java b/src/main/java/sevenUnits/unit/UnitDatabase.java
index 444b366..95e953f 100644
--- a/src/main/java/sevenUnits/unit/UnitDatabase.java
+++ b/src/main/java/sevenUnits/unit/UnitDatabase.java
@@ -212,6 +212,8 @@ public final class UnitDatabase {
* Creates the
* {@code UnitsDatabase.PrefixedUnitMap.PrefixedUnitNameSet.PrefixedUnitNameIterator}.
*
+ * @param map map to base iterator on
+ *
* @since 2019-04-14
* @since v0.2.0
*/
@@ -527,6 +529,8 @@ public final class UnitDatabase {
* Creates the
* {@code UnitsDatabase.PrefixedUnitMap.PrefixedUnitNameSet.PrefixedUnitNameIterator}.
*
+ * @param map map to base itorator on
+ *
* @since 2019-04-14
* @since v0.2.0
*/
@@ -1529,6 +1533,9 @@ public final class UnitDatabase {
/**
* Returns true iff there is a unit set with this name.
+ *
+ * @param name name to check for
+ * @return true iff there is a unit set with this name
*
* @since 2024-08-16
*/
@@ -1574,7 +1581,7 @@ public final class UnitDatabase {
// the previous operation breaks negative numbers, fix them!
// (i.e. -2 becomes - 2)
- // FIXME the previous operaton also breaks stuff like "1e-5"
+ // FIXME the previous operation also breaks stuff like "1e-5"
for (int i = 0; i < modifiedExpression.length(); i++) {
if (modifiedExpression.charAt(i) == '-'
&& (i < 2 || Arrays.asList('+', '-', '*', '/', '|', '^')
@@ -1620,6 +1627,7 @@ public final class UnitDatabase {
* </ul>
*
* @param expression expression to parse
+ * @return parsed unit dimension
* @throws IllegalArgumentException if the expression cannot be parsed
* @throws NullPointerException if expression is null
* @since 2019-04-13
@@ -1848,6 +1856,7 @@ public final class UnitDatabase {
* This method only works with linear units.
*
* @param expression expression to parse
+ * @return parsed unit
* @throws IllegalArgumentException if the expression cannot be parsed
* @throws NullPointerException if expression is null
* @since 2019-01-07
@@ -1890,6 +1899,9 @@ public final class UnitDatabase {
/**
* Get a unit set from its name, throwing a {@link NoSuchElementException} if
* there is none.
+ *
+ * @param name name of unit set
+ * @return unit set with that name
*
* @since 2024-08-16
*/
@@ -1977,6 +1989,7 @@ public final class UnitDatabase {
* {@link #loadDimensionFile}.
*
* @param stream stream to load from
+ * @return list of all errors that happened loading the stream
* @since 2021-03-27
*/
public List<LoadingException> loadDimensionsFromStream(
@@ -2047,6 +2060,7 @@ public final class UnitDatabase {
* {@link #loadUnitsFile}.
*
* @param stream stream to load from
+ * @return list of all errors that happened loading the stream
* @since 2021-03-27
*/
public List<LoadingException> loadUnitsFromStream(InputStream stream) {
diff --git a/src/main/java/sevenUnits/unit/UnitPrefix.java b/src/main/java/sevenUnits/unit/UnitPrefix.java
index ec4be48..be4d8fb 100644
--- a/src/main/java/sevenUnits/unit/UnitPrefix.java
+++ b/src/main/java/sevenUnits/unit/UnitPrefix.java
@@ -124,6 +124,7 @@ public final class UnitPrefix implements Nameable {
}
/**
+ * @param other prefix to compare to
* @return true iff this prefix and other are equal,
* ignoring small differences caused by floating-point error.
*
@@ -175,6 +176,8 @@ public final class UnitPrefix implements Nameable {
/**
* Adds {@code other} to this prefix and returns the result.
+ * @param other prefix to add
+ * @return sum of prefixes
*
* @since 2024-03-03
*/
@@ -184,6 +187,8 @@ public final class UnitPrefix implements Nameable {
/**
* Subtracts {@code other} from this prefix and returns the result.
+ * @param other prefix to subtract
+ * @return difference of prefixes
*
* @since 2024-03-03
*/
diff --git a/src/main/java/sevenUnits/unit/UnitType.java b/src/main/java/sevenUnits/unit/UnitType.java
index 9a87288..6c0f7a9 100644
--- a/src/main/java/sevenUnits/unit/UnitType.java
+++ b/src/main/java/sevenUnits/unit/UnitType.java
@@ -32,7 +32,12 @@ import java.util.function.Predicate;
* @since 2022-04-10
*/
public enum UnitType {
- METRIC, SEMI_METRIC, NON_METRIC;
+ /** Units that pass {@link Unit#isMetric} */
+ METRIC,
+ /** certain exceptions like the degree Celsius */
+ SEMI_METRIC,
+ /** Non-metric, non-excepted units */
+ NON_METRIC;
/**
* Determines which type a unit is. The type will be:
diff --git a/src/main/java/sevenUnits/unit/UnitValue.java b/src/main/java/sevenUnits/unit/UnitValue.java
index 9b485e3..aee836e 100644
--- a/src/main/java/sevenUnits/unit/UnitValue.java
+++ b/src/main/java/sevenUnits/unit/UnitValue.java
@@ -56,6 +56,7 @@ public final class UnitValue {
}
/**
+ * @param other unit to try to convert to
* @return true if this value can be converted to {@code other}.
* @since 2020-10-01
*/
@@ -76,11 +77,12 @@ public final class UnitValue {
}
/**
- * Returns this unit value represented as a {@code LinearUnitValue} with this
+ * Returns this unit value represented as a {@link LinearUnitValue} with this
* unit's base unit as the base.
*
* @param ns name and symbol for the base unit, use NameSymbol.EMPTY if not
* needed.
+ * @return this unit as a {@link LinearUnitValue}
* @since 2020-09-29
*/
public final LinearUnitValue convertToBase(NameSymbol ns) {
@@ -89,13 +91,14 @@ public final class UnitValue {
}
/**
+ * @param newUnit unit to use for this value
* @return a {@code LinearUnitValue} that is equivalent to this value. It
* will have zero uncertainty.
* @since 2020-09-29
*/
- public final LinearUnitValue convertToLinear(LinearUnit other) {
- return LinearUnitValue.getExact(other,
- this.getUnit().convertTo(other, this.getValue()));
+ public final LinearUnitValue convertToLinear(LinearUnit newUnit) {
+ return LinearUnitValue.getExact(newUnit,
+ this.getUnit().convertTo(newUnit, this.getValue()));
}
/**