summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Hopkins <masterofnumbers17@gmail.com>2019-10-21 15:17:50 -0400
committerAdrien Hopkins <masterofnumbers17@gmail.com>2019-10-21 15:17:50 -0400
commit1bf43ad95e70019a69e91e09ff74f677082ed6f5 (patch)
tree14c381f280ed3a5c2f15eda201ba1204ccf43fc7
parente28907d4bf4234cb988a5e76ebf7122c7c1ff6cb (diff)
Made improvements and corrections to the documentation.
-rw-r--r--src/org/unitConverter/converterGUI/UnitConverterGUI.java2
-rw-r--r--src/org/unitConverter/converterGUI/package-info.java2
-rw-r--r--src/org/unitConverter/math/package-info.java3
-rw-r--r--src/org/unitConverter/unit/LinearUnit.java8
-rw-r--r--src/org/unitConverter/unit/Unit.java14
-rw-r--r--src/org/unitConverter/unit/package-info.java3
6 files changed, 22 insertions, 10 deletions
diff --git a/src/org/unitConverter/converterGUI/UnitConverterGUI.java b/src/org/unitConverter/converterGUI/UnitConverterGUI.java
index 4598971..511e47b 100644
--- a/src/org/unitConverter/converterGUI/UnitConverterGUI.java
+++ b/src/org/unitConverter/converterGUI/UnitConverterGUI.java
@@ -47,8 +47,8 @@ import org.unitConverter.unit.BaseDimension;
import org.unitConverter.unit.LinearUnit;
import org.unitConverter.unit.SI;
import org.unitConverter.unit.Unit;
-import org.unitConverter.unit.UnitPrefix;
import org.unitConverter.unit.UnitDatabase;
+import org.unitConverter.unit.UnitPrefix;
/**
* @author Adrien Hopkins
diff --git a/src/org/unitConverter/converterGUI/package-info.java b/src/org/unitConverter/converterGUI/package-info.java
index 1555291..d85ecab 100644
--- a/src/org/unitConverter/converterGUI/package-info.java
+++ b/src/org/unitConverter/converterGUI/package-info.java
@@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
- * All classes that work to convert units.
+ * The GUI interface of the Unit Converter.
*
* @author Adrien Hopkins
* @since 2019-01-25
diff --git a/src/org/unitConverter/math/package-info.java b/src/org/unitConverter/math/package-info.java
index 65d6b23..65727e4 100644
--- a/src/org/unitConverter/math/package-info.java
+++ b/src/org/unitConverter/math/package-info.java
@@ -15,9 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
- * A module that is capable of parsing expressions of things, like mathematical expressions or unit expressions.
+ * Supplementary classes that are not related to units, but are necessary for their function.
*
* @author Adrien Hopkins
* @since 2019-03-14
+ * @since v0.2.0
*/
package org.unitConverter.math; \ No newline at end of file
diff --git a/src/org/unitConverter/unit/LinearUnit.java b/src/org/unitConverter/unit/LinearUnit.java
index c397250..1918d6b 100644
--- a/src/org/unitConverter/unit/LinearUnit.java
+++ b/src/org/unitConverter/unit/LinearUnit.java
@@ -167,8 +167,8 @@ public final class LinearUnit extends Unit {
/**
* Returns the difference of this unit and another.
* <p>
- * Two units can be subtracted if they have the same base. If {@code subtrahend} does not meet this condition, an
- * {@code IllegalArgumentException} will be thrown.
+ * Two units can be subtracted if they have the same base. Note that {@link #canConvertTo} can be used to determine
+ * this. If {@code subtrahend} does not meet this condition, an {@code IllegalArgumentException} will be thrown.
* </p>
*
* @param subtrahend
@@ -196,8 +196,8 @@ public final class LinearUnit extends Unit {
/**
* Returns the sum of this unit and another.
* <p>
- * Two units can be added if they have the same base. If {@code addend} does not meet this condition, an
- * {@code IllegalArgumentException} will be thrown.
+ * Two units can be added if they have the same base. Note that {@link #canConvertTo} can be used to determine this.
+ * If {@code addend} does not meet this condition, an {@code IllegalArgumentException} will be thrown.
* </p>
*
* @param addend
diff --git a/src/org/unitConverter/unit/Unit.java b/src/org/unitConverter/unit/Unit.java
index d4eb86e..7971a41 100644
--- a/src/org/unitConverter/unit/Unit.java
+++ b/src/org/unitConverter/unit/Unit.java
@@ -52,7 +52,7 @@ public abstract class Unit {
* @throws NullPointerException
* if any argument is null
*/
- public static Unit fromConversionFunctions(final ObjectProduct<BaseUnit> base,
+ public static final Unit fromConversionFunctions(final ObjectProduct<BaseUnit> base,
final DoubleUnaryOperator converterFrom, final DoubleUnaryOperator converterTo) {
return FunctionalUnit.valueOf(base, converterFrom, converterTo);
}
@@ -121,6 +121,9 @@ public abstract class Unit {
* If this unit <i>is</i> a base unit, this method should return {@code value}.
* </p>
*
+ * @implSpec This method is used by {@link #convertTo}, and its behaviour affects the behaviour of
+ * {@code convertTo}.
+ *
* @param value
* value expressed in <b>base</b> unit
* @return value expressed in <b>this</b> unit
@@ -132,6 +135,10 @@ public abstract class Unit {
/**
* Converts a value expressed in this unit to a value expressed in {@code other}.
*
+ * @implSpec If unit conversion is possible, this implementation returns
+ * {@code other.convertFromBase(this.convertToBase(value))}. Therefore, overriding either of those methods
+ * will change the output of this method.
+ *
* @param other
* unit to convert to
* @param value
@@ -140,7 +147,7 @@ public abstract class Unit {
* @since 2019-05-22
* @throws IllegalArgumentException
* if {@code other} is incompatible for conversion with this unit (as tested by
- * {@link IUnit#canConvertTo}).
+ * {@link Unit#canConvertTo}).
* @throws NullPointerException
* if other is null
*/
@@ -162,6 +169,9 @@ public abstract class Unit {
* If this unit <i>is</i> a base unit, this method should return {@code value}.
* </p>
*
+ * @implSpec This method is used by {@link #convertTo}, and its behaviour affects the behaviour of
+ * {@code convertTo}.
+ *
* @param value
* value expressed in <b>this</b> unit
* @return value expressed in <b>base</b> unit
diff --git a/src/org/unitConverter/unit/package-info.java b/src/org/unitConverter/unit/package-info.java
index 2d83e1f..2f0e097 100644
--- a/src/org/unitConverter/unit/package-info.java
+++ b/src/org/unitConverter/unit/package-info.java
@@ -15,9 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
- * The new definition for units.
+ * Everything to do with the units that make up Unit Converter.
*
* @author Adrien Hopkins
* @since 2019-10-16
+ * @since v0.1.0
*/
package org.unitConverter.unit; \ No newline at end of file