summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnitsGUI
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/sevenUnitsGUI')
-rw-r--r--src/main/java/sevenUnitsGUI/DefaultPrefixRepetitionRule.java1
-rw-r--r--src/main/java/sevenUnitsGUI/DelegateListModel.java1
-rw-r--r--src/main/java/sevenUnitsGUI/ExpressionConversionView.java8
-rw-r--r--src/main/java/sevenUnitsGUI/Main.java4
-rw-r--r--src/main/java/sevenUnitsGUI/PrefixSearchRule.java12
-rw-r--r--src/main/java/sevenUnitsGUI/Presenter.java45
-rw-r--r--src/main/java/sevenUnitsGUI/SearchBoxList.java5
-rw-r--r--src/main/java/sevenUnitsGUI/StandardDisplayRules.java20
-rw-r--r--src/main/java/sevenUnitsGUI/TabbedView.java20
-rw-r--r--src/main/java/sevenUnitsGUI/UnitConversionRecord.java17
-rw-r--r--src/main/java/sevenUnitsGUI/UnitConversionView.java24
-rw-r--r--src/main/java/sevenUnitsGUI/View.java20
-rw-r--r--src/main/java/sevenUnitsGUI/ViewBot.java26
-rw-r--r--src/main/java/sevenUnitsGUI/package-info.java1
14 files changed, 144 insertions, 60 deletions
diff --git a/src/main/java/sevenUnitsGUI/DefaultPrefixRepetitionRule.java b/src/main/java/sevenUnitsGUI/DefaultPrefixRepetitionRule.java
index fbf78a3..97df107 100644
--- a/src/main/java/sevenUnitsGUI/DefaultPrefixRepetitionRule.java
+++ b/src/main/java/sevenUnitsGUI/DefaultPrefixRepetitionRule.java
@@ -26,6 +26,7 @@ import sevenUnits.unit.UnitPrefix;
* A rule that specifies whether prefix repetition is allowed
*
* @since 2020-08-26
+ * @since v0.3.0
*/
public enum DefaultPrefixRepetitionRule implements Predicate<List<UnitPrefix>> {
/** Prefix repetition is never allowed; only one prefix may be used. */
diff --git a/src/main/java/sevenUnitsGUI/DelegateListModel.java b/src/main/java/sevenUnitsGUI/DelegateListModel.java
index 4925197..200eee2 100644
--- a/src/main/java/sevenUnitsGUI/DelegateListModel.java
+++ b/src/main/java/sevenUnitsGUI/DelegateListModel.java
@@ -56,6 +56,7 @@ final class DelegateListModel<E> extends AbstractListModel<E>
* Creates an empty {@code DelegateListModel}.
*
* @since 2019-04-13
+ * @since v0.2.0
*/
public DelegateListModel() {
this(new ArrayList<>());
diff --git a/src/main/java/sevenUnitsGUI/ExpressionConversionView.java b/src/main/java/sevenUnitsGUI/ExpressionConversionView.java
index ead07c5..20eb23c 100644
--- a/src/main/java/sevenUnitsGUI/ExpressionConversionView.java
+++ b/src/main/java/sevenUnitsGUI/ExpressionConversionView.java
@@ -20,21 +20,21 @@ package sevenUnitsGUI;
* A View that can convert unit expressions
*
* @author Adrien Hopkins
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
public interface ExpressionConversionView extends View {
/**
* @return unit expression to convert <em>from</em>
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
String getFromExpression();
/**
* @return unit expression to convert <em>to</em>
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
String getToExpression();
@@ -42,8 +42,8 @@ public interface ExpressionConversionView extends View {
* Shows the output of an expression conversion to the user.
*
* @param uc unit conversion to show
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
void showExpressionConversionOutput(UnitConversionRecord uc);
}
diff --git a/src/main/java/sevenUnitsGUI/Main.java b/src/main/java/sevenUnitsGUI/Main.java
index b573a09..3ff2fd9 100644
--- a/src/main/java/sevenUnitsGUI/Main.java
+++ b/src/main/java/sevenUnitsGUI/Main.java
@@ -19,8 +19,8 @@ package sevenUnitsGUI;
/**
* The main code for the 7Units GUI
*
- * @since v0.4.0
* @since 2022-04-19
+ * @since v0.4.0
*/
public final class Main {
@@ -28,8 +28,8 @@ public final class Main {
* The main method that starts 7Units
*
* @param args commandline arguments
- * @since v0.4.0
* @since 2022-04-19
+ * @since v0.4.0
*/
public static void main(String[] args) {
View.createTabbedView();
diff --git a/src/main/java/sevenUnitsGUI/PrefixSearchRule.java b/src/main/java/sevenUnitsGUI/PrefixSearchRule.java
index 1937fd2..2ea0923 100644
--- a/src/main/java/sevenUnitsGUI/PrefixSearchRule.java
+++ b/src/main/java/sevenUnitsGUI/PrefixSearchRule.java
@@ -34,8 +34,8 @@ import sevenUnits.unit.UnitPrefix;
* A search rule that applies a certain set of prefixes to a unit. It always
* includes the original unit in the output map.
*
- * @since v0.4.0
* @since 2022-07-06
+ * @since v0.4.0
*/
public final class PrefixSearchRule implements
Function<Map.Entry<String, LinearUnit>, Map<String, LinearUnit>> {
@@ -70,8 +70,8 @@ public final class PrefixSearchRule implements
*
* @param prefixes prefixes to apply
* @return prefix rule
- * @since v0.4.0
* @since 2022-07-06
+ * @since v0.4.0
*/
public static final PrefixSearchRule getCoherentOnlyRule(
Set<UnitPrefix> prefixes) {
@@ -84,8 +84,8 @@ public final class PrefixSearchRule implements
*
* @param prefixes prefixes to apply
* @return prefix rule
- * @since v0.4.0
* @since 2022-07-06
+ * @since v0.4.0
*/
public static final PrefixSearchRule getUniversalRule(
Set<UnitPrefix> prefixes) {
@@ -106,8 +106,8 @@ public final class PrefixSearchRule implements
* @param prefixes prefixes to add to units
* @param prefixableUnitRule function that determines which units get
* prefixes
- * @since v0.4.0
* @since 2022-07-06
+ * @since v0.4.0
*/
public PrefixSearchRule(Set<UnitPrefix> prefixes,
Predicate<LinearUnit> prefixableUnitRule) {
@@ -143,8 +143,8 @@ public final class PrefixSearchRule implements
/**
* @return rule that determines which units get prefixes
- * @since v0.4.0
* @since 2022-07-09
+ * @since v0.4.0
*/
public Predicate<LinearUnit> getPrefixableUnitRule() {
return this.prefixableUnitRule;
@@ -152,8 +152,8 @@ public final class PrefixSearchRule implements
/**
* @return the prefixes that are applied by this rule
- * @since v0.4.0
* @since 2022-07-06
+ * @since v0.4.0
*/
public Set<UnitPrefix> getPrefixes() {
return this.prefixes;
diff --git a/src/main/java/sevenUnitsGUI/Presenter.java b/src/main/java/sevenUnitsGUI/Presenter.java
index 7c66d55..ff7e23c 100644
--- a/src/main/java/sevenUnitsGUI/Presenter.java
+++ b/src/main/java/sevenUnitsGUI/Presenter.java
@@ -60,6 +60,7 @@ import sevenUnitsGUI.StandardDisplayRules.UncertaintyBased;
*
* @author Adrien Hopkins
* @since 2021-12-15
+ * @since v0.4.0
*/
public final class Presenter {
/**
@@ -139,6 +140,7 @@ public final class Presenter {
* {@code maxLineLength}. If no good spot is found, returns -1.
*
* @since 2024-08-22
+ * @since v1.0.0
*/
private static int findLineSplit(String toWrap, int maxLineLength) {
for (var i = maxLineLength - 1; i >= 0; i--) {
@@ -155,6 +157,7 @@ public final class Presenter {
* @param filename filename to get resource from
* @return contents of file
* @since 2021-03-27
+ * @since v0.3.0
*/
private static List<String> getLinesFromResource(String filename) {
final List<String> lines = new ArrayList<>();
@@ -178,6 +181,7 @@ public final class Presenter {
* @param filepath file to use as resource
* @return obtained Path
* @since 2021-03-27
+ * @since v0.3.0
*/
private static InputStream inputStream(String filepath) {
return Presenter.class.getResourceAsStream(filepath);
@@ -188,6 +192,7 @@ public final class Presenter {
* the nearest integer.
*
* @since 2024-08-16
+ * @since v1.0.0
*/
private static String linearUnitValueIntToString(LinearUnitValue uv) {
return Long.toString(Math.round(uv.getValueExact())) + " " + uv.getUnit();
@@ -227,6 +232,7 @@ public final class Presenter {
/**
* @return true iff a and b have any elements in common
* @since 2022-04-19
+ * @since v0.4.0
*/
private static boolean sharesAnyElements(Set<?> a, Set<?> b) {
for (final Object e : a) {
@@ -254,6 +260,7 @@ public final class Presenter {
/**
* @return {@code line} with any comments removed.
* @since 2021-03-13
+ * @since v0.3.0
*/
private static String withoutComments(String line) {
final var index = line.indexOf('#');
@@ -264,6 +271,7 @@ public final class Presenter {
* Wraps a string, ensuring no line is longer than {@code maxLineLength}.
*
* @since 2024-08-22
+ * @since v1.0.0
*/
private static String wrapString(String toWrap, int maxLineLength) {
final var wrapped = new StringBuilder(toWrap.length());
@@ -366,6 +374,7 @@ public final class Presenter {
*
* @param view the view that this presenter communicates with
* @since 2021-12-15
+ * @since v0.4.0
*/
public Presenter(View view) {
this.view = view;
@@ -449,6 +458,7 @@ public final class Presenter {
* @param e entry
* @return stream of entries, ready for flat-mapping
* @since 2022-07-06
+ * @since v0.4.0
*/
private Stream<Map.Entry<String, Unit>> applySearchRule(
Map.Entry<String, Unit> e) {
@@ -472,6 +482,7 @@ public final class Presenter {
* not implement
* {@link ExpressionConversionView})
* @since 2021-12-15
+ * @since v0.4.0
*/
public void convertExpressions() {
if (!(this.view instanceof ExpressionConversionView))
@@ -515,6 +526,7 @@ public final class Presenter {
* returned.
*
* @since 2024-08-15
+ * @since v1.0.0
*/
private Optional<UnitConversionRecord> convertExpressionToExpression(
String fromExpression, String toExpression) {
@@ -567,6 +579,7 @@ public final class Presenter {
* the view and Optional.empty() is returned.
*
* @since 2024-08-15
+ * @since v1.0.0
*/
private Optional<UnitConversionRecord> convertExpressionToMultiUnit(
String fromExpression, String[] toExpressions) {
@@ -617,6 +630,7 @@ public final class Presenter {
* error happened, it is shown to the view and Optional.empty() is returned.
*
* @since 2024-08-15
+ * @since v1.0.0
*/
private Optional<UnitConversionRecord> convertExpressionToNamedMultiUnit(
String fromExpression, String toName) {
@@ -653,6 +667,7 @@ public final class Presenter {
* implement
* {@link UnitConversionView})
* @since 2021-12-15
+ * @since v0.4.0
*/
public void convertUnits() {
if (!(this.view instanceof UnitConversionView))
@@ -770,6 +785,7 @@ public final class Presenter {
/**
* @return true iff duplicate units are shown in unit lists
* @since 2022-03-30
+ * @since v0.4.0
*/
public boolean duplicatesShown() {
return this.showDuplicates;
@@ -778,6 +794,7 @@ public final class Presenter {
/**
* @return text in About file
* @since 2022-02-19
+ * @since v0.4.0
*/
public String getAboutText() {
final Path customFilepath = Presenter.pathFromConfig(
@@ -809,6 +826,7 @@ public final class Presenter {
/**
* @return set of all locales available to select
* @since 2025-02-21
+ * @since v1.0.0
*/
public Set<String> getAvailableLocales() {
return this.locales.keySet();
@@ -820,6 +838,7 @@ public final class Presenter {
* @param dimension dimension to name
* @return name of dimension
* @since 2022-04-16
+ * @since v0.4.0
*/
String getDimensionName(ObjectProduct<BaseDimension> dimension) {
// find this dimension in the database and get its name
@@ -847,6 +866,7 @@ public final class Presenter {
* @return the rule that is used by this presenter to convert numbers into
* strings
* @since 2022-04-10
+ * @since v0.4.0
*/
public Function<UncertainDouble, String> getNumberDisplayRule() {
return this.numberDisplayRule;
@@ -856,6 +876,7 @@ public final class Presenter {
* @return the rule that is used by this presenter to convert strings into
* numbers
* @since 2022-04-10
+ * @since v0.4.0
*/
@SuppressWarnings("unused") // not implemented yet
private Function<String, UncertainDouble> getNumberParsingRule() {
@@ -865,6 +886,7 @@ public final class Presenter {
/**
* @return the rule that determines whether a set of prefixes is valid
* @since 2022-04-19
+ * @since v0.4.0
*/
public Predicate<List<UnitPrefix>> getPrefixRepetitionRule() {
return this.prefixRepetitionRule;
@@ -873,6 +895,7 @@ public final class Presenter {
/**
* @return the rule that determines which units are prefixed
* @since 2022-07-08
+ * @since v0.4.0
*/
public Function<Map.Entry<String, LinearUnit>, Map<String, LinearUnit>> getSearchRule() {
return this.searchRule;
@@ -881,6 +904,7 @@ public final class Presenter {
/**
* @return a search rule that shows all single prefixes
* @since 2022-07-08
+ * @since v0.4.0
*/
public Function<Map.Entry<String, LinearUnit>, Map<String, LinearUnit>> getUniversalSearchRule() {
return PrefixSearchRule.getCoherentOnlyRule(
@@ -890,6 +914,7 @@ public final class Presenter {
/**
* @return user's selected locale
* @since 2025-02-21
+ * @since v1.0.0
*/
public String getUserLocale() {
return userLocale;
@@ -898,6 +923,7 @@ public final class Presenter {
/**
* @return the view associated with this presenter
* @since 2022-04-19
+ * @since v0.4.0
*/
public View getView() {
return this.view;
@@ -908,6 +934,7 @@ public final class Presenter {
* message and alerts the user.
*
* @since 2024-08-22
+ * @since v1.0.0
*/
private void handleLoadErrors(List<LoadingException> errors) {
if (!errors.isEmpty()) {
@@ -925,6 +952,7 @@ public final class Presenter {
* @return whether or not the provided unit is semi-metric (i.e. an
* exception)
* @since 2022-04-16
+ * @since v0.4.0
*/
boolean isSemiMetric(Unit u) {
// determine if u is an exception
@@ -944,6 +972,7 @@ public final class Presenter {
* number display rule.
*
* @since 2024-08-16
+ * @since v1.0.0
*/
private String linearUnitValueSumToString(List<LinearUnitValue> values) {
final var integerPart = values.subList(0, values.size() - 1).stream()
@@ -1018,6 +1047,7 @@ public final class Presenter {
*
* @param settingsFile file settings should be loaded from
* @since 2021-12-15
+ * @since v0.4.0
*/
void loadSettings(Path settingsFile) {
this.customDimensionFiles.clear();
@@ -1086,6 +1116,7 @@ public final class Presenter {
/**
* @return a message showing how much stuff has been loaded
* @since 2024-08-22
+ * @since v1.0.0
*/
private String loadStatMsg() {
return this.getLocalizedText("load_stat_msg")
@@ -1107,6 +1138,7 @@ public final class Presenter {
* unit list and imperial/USC units removed from the To unit list)
*
* @since 2022-03-30
+ * @since v0.4.0
*/
public boolean oneWayConversionEnabled() {
return this.oneWayConversionEnabled;
@@ -1118,6 +1150,7 @@ public final class Presenter {
* they depend on are not created yet.
*
* @since 2022-02-26
+ * @since v0.4.0
*/
public void postViewInitialize() {
// unit conversion specific stuff
@@ -1148,6 +1181,7 @@ public final class Presenter {
*
* @return false iff the presenter could not write to the file
* @since 2022-04-19
+ * @since v0.4.0
*/
public boolean saveSettings() {
final var configDir = CONFIG_FILE.getParent();
@@ -1187,6 +1221,7 @@ public final class Presenter {
* @param numberDisplayRule the new rule that will be used by this presenter
* to convert numbers into strings
* @since 2022-04-10
+ * @since v0.4.0
*/
public void setNumberDisplayRule(
Function<UncertainDouble, String> numberDisplayRule) {
@@ -1197,6 +1232,7 @@ public final class Presenter {
* @param numberParsingRule the new rule that will be used by this presenter
* to convert strings into numbers
* @since 2022-04-10
+ * @since v0.4.0
*/
@SuppressWarnings("unused") // not implemented yet
private void setNumberParsingRule(
@@ -1208,6 +1244,7 @@ public final class Presenter {
* @param oneWayConversionEnabled whether not one-way conversion should be
* enabled
* @since 2022-03-30
+ * @since v0.4.0
* @see #oneWayConversionEnabled
*/
public void setOneWayConversionEnabled(boolean oneWayConversionEnabled) {
@@ -1219,6 +1256,7 @@ public final class Presenter {
* @param prefixRepetitionRule the rule that determines whether a set of
* prefixes is valid
* @since 2022-04-19
+ * @since v0.4.0
*/
public void setPrefixRepetitionRule(
Predicate<List<UnitPrefix>> prefixRepetitionRule) {
@@ -1232,6 +1270,7 @@ public final class Presenter {
* unit (including the unit itself) that should be
* searchable.
* @since 2022-07-08
+ * @since v0.4.0
*/
public void setSearchRule(
Function<Map.Entry<String, LinearUnit>, Map<String, LinearUnit>> searchRule) {
@@ -1259,6 +1298,7 @@ public final class Presenter {
/**
* @param showDuplicateUnits whether or not duplicate units should be shown
* @since 2022-03-30
+ * @since v0.4.0
*/
public void setShowDuplicates(boolean showDuplicateUnits) {
this.showDuplicates = showDuplicateUnits;
@@ -1304,6 +1344,7 @@ public final class Presenter {
*
* @param u unit to show
* @since 2022-04-16
+ * @since v0.4.0
*/
private void showUnit(Unit u) {
final var nameSymbol = u.getNameSymbol();
@@ -1320,6 +1361,7 @@ public final class Presenter {
* description of a unit and displays it.
*
* @since 2022-04-10
+ * @since v0.4.0
*/
void unitNameSelected() {
// get selected unit, if it's there and valid
@@ -1335,6 +1377,7 @@ public final class Presenter {
* Updates the view's From and To units, if it has some
*
* @since 2021-12-15
+ * @since v0.4.0
*/
public void updateView() {
if (this.view instanceof UnitConversionView) {
@@ -1402,6 +1445,7 @@ public final class Presenter {
* @return AssertionError stating that an error has happened in the view's
* code
* @since 2022-04-09
+ * @since v0.4.0
*/
private AssertionError viewError(String message, Object... args) {
return new AssertionError("View Programming Error (from " + this.view
@@ -1413,6 +1457,7 @@ public final class Presenter {
*
* @param settingsFile file settings should be saved to
* @since 2021-12-15
+ * @since v0.4.0
*/
boolean writeSettings(Path settingsFile) {
try (var writer = Files.newBufferedWriter(settingsFile)) {
diff --git a/src/main/java/sevenUnitsGUI/SearchBoxList.java b/src/main/java/sevenUnitsGUI/SearchBoxList.java
index 1748083..43a57ce 100644
--- a/src/main/java/sevenUnitsGUI/SearchBoxList.java
+++ b/src/main/java/sevenUnitsGUI/SearchBoxList.java
@@ -84,6 +84,7 @@ final class SearchBoxList<E> extends JPanel {
* Creates an empty SearchBoxList
*
* @since 2022-02-19
+ * @since v0.4.0
*/
public SearchBoxList() {
this(List.of(), null, false);
@@ -94,6 +95,7 @@ final class SearchBoxList<E> extends JPanel {
*
* @param itemsToFilter items to put in the list
* @since 2019-04-14
+ * @since v0.2.0
*/
public SearchBoxList(final Collection<E> itemsToFilter) {
this(itemsToFilter, null, false);
@@ -170,6 +172,7 @@ final class SearchBoxList<E> extends JPanel {
* @return items available in search list, including items that are hidden by
* the search filter
* @since 2022-03-30
+ * @since v0.4.0
*/
public Collection<E> getItems() {
return Collections.unmodifiableCollection(this.itemsToFilter);
@@ -323,6 +326,7 @@ final class SearchBoxList<E> extends JPanel {
*
* @param newItems new items to put in list
* @since 2021-05-22
+ * @since v0.3.0
*/
public void setItems(Collection<? extends E> newItems) {
this.itemsToFilter.clear();
@@ -334,6 +338,7 @@ final class SearchBoxList<E> extends JPanel {
* Manually updates the search box's item list.
*
* @since 2020-08-27
+ * @since v0.3.0
*/
public void updateList() {
this.searchBoxTextChanged();
diff --git a/src/main/java/sevenUnitsGUI/StandardDisplayRules.java b/src/main/java/sevenUnitsGUI/StandardDisplayRules.java
index a19b680..d710117 100644
--- a/src/main/java/sevenUnitsGUI/StandardDisplayRules.java
+++ b/src/main/java/sevenUnitsGUI/StandardDisplayRules.java
@@ -28,15 +28,15 @@ import sevenUnits.utils.UncertainDouble;
* A static utility class that can be used to make display rules for the
* presenter.
*
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
public final class StandardDisplayRules {
/**
* A rule that rounds to a fixed number of decimal places.
*
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
public static final class FixedDecimals
implements Function<UncertainDouble, String> {
@@ -51,6 +51,7 @@ public final class StandardDisplayRules {
/**
* @param decimalPlaces
* @since 2022-04-18
+ * @since v0.4.0
*/
private FixedDecimals(int decimalPlaces) {
this.decimalPlaces = decimalPlaces;
@@ -66,6 +67,7 @@ public final class StandardDisplayRules {
/**
* @return the number of decimal places this rule rounds to
* @since 2022-04-18
+ * @since v0.4.0
*/
public int decimalPlaces() {
return this.decimalPlaces;
@@ -97,8 +99,8 @@ public final class StandardDisplayRules {
/**
* A rule that rounds to a fixed number of significant digits.
*
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
public static final class FixedPrecision
implements Function<UncertainDouble, String> {
@@ -114,6 +116,7 @@ public final class StandardDisplayRules {
/**
* @param significantFigures
* @since 2022-04-18
+ * @since v0.4.0
*/
private FixedPrecision(int significantFigures) {
this.mathContext = new MathContext(significantFigures,
@@ -150,6 +153,7 @@ public final class StandardDisplayRules {
/**
* @return the number of significant figures this rule rounds to
* @since 2022-04-18
+ * @since v0.4.0
*/
public int significantFigures() {
return this.mathContext.getPrecision();
@@ -167,8 +171,8 @@ public final class StandardDisplayRules {
* This means the output will have around as many significant figures as the
* input.
*
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
public static final class UncertaintyBased
implements Function<UncertainDouble, String> {
@@ -195,8 +199,8 @@ public final class StandardDisplayRules {
/**
* @param decimalPlaces decimal places to round to
* @return a rounding rule that rounds to fixed number of decimal places
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
public static final FixedDecimals fixedDecimals(int decimalPlaces) {
return new FixedDecimals(decimalPlaces);
@@ -206,8 +210,8 @@ public final class StandardDisplayRules {
* @param significantFigures significant figures to round to
* @return a rounding rule that rounds to a fixed number of significant
* figures
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
public static final FixedPrecision fixedPrecision(int significantFigures) {
return new FixedPrecision(significantFigures);
@@ -220,8 +224,8 @@ public final class StandardDisplayRules {
* @return display rule
* @throws IllegalArgumentException if the provided string is not that of a
* standard rule.
- * @since v0.4.0
* @since 2021-12-24
+ * @since v0.4.0
*/
public static final Function<UncertainDouble, String> getStandardRule(
String ruleToString) {
@@ -246,8 +250,8 @@ public final class StandardDisplayRules {
/**
* @return an UncertainDouble-based rounding rule
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
public static final UncertaintyBased uncertaintyBased() {
return UNCERTAINTY_BASED_ROUNDING_RULE;
diff --git a/src/main/java/sevenUnitsGUI/TabbedView.java b/src/main/java/sevenUnitsGUI/TabbedView.java
index 97b93dc..1afaf33 100644
--- a/src/main/java/sevenUnitsGUI/TabbedView.java
+++ b/src/main/java/sevenUnitsGUI/TabbedView.java
@@ -67,8 +67,8 @@ import sevenUnits.utils.UncertainDouble;
/**
* A View that separates its functions into multiple tabs
*
- * @since v0.4.0
* @since 2022-02-19
+ * @since v0.4.0
*/
final class TabbedView implements ExpressionConversionView, UnitConversionView {
/**
@@ -76,8 +76,8 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
*
* @param <E> type of item in list
*
- * @since v0.4.0
* @since 2022-02-19
+ * @since v0.4.0
*/
private static final class JComboBoxItemSet<E> extends AbstractSet<E> {
private final JComboBox<E> comboBox;
@@ -85,6 +85,7 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
/**
* @param comboBox combo box to get items from
* @since 2022-02-19
+ * @since v0.4.0
*/
public JComboBoxItemSet(JComboBox<E> comboBox) {
this.comboBox = comboBox;
@@ -122,8 +123,8 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
* The standard types of rounding, corresponding to the options on the
* TabbedView's settings panel.
*
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
private static enum StandardRoundingType {
/**
@@ -147,8 +148,8 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
* Creates a TabbedView.
*
* @param args command line arguments
- * @since v0.4.0
* @since 2022-02-19
+ * @since v0.4.0
*/
public static void main(String[] args) {
// This view doesn't need to do anything, the side effects of creating it
@@ -209,8 +210,8 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
/**
* Creates the view and makes it visible to the user
*
- * @since v0.4.0
* @since 2022-02-19
+ * @since v0.4.0
*/
public TabbedView() {
// enable system look and feel
@@ -401,6 +402,7 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
* code more organized, as this function is massive!)
*
* @since 2022-02-19
+ * @since v0.4.0
*/
private JPanel createSettingsPanel() {
final JPanel settingsPanel = new JPanel();
@@ -737,8 +739,8 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
/**
* @return the precision of the presenter's rounding rule, if that is
* meaningful
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
private OptionalInt getPresenterPrecision() {
final var presenterRule = this.presenter.getNumberDisplayRule();
@@ -756,8 +758,8 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
/**
* @return presenter's prefix repetition rule
- * @since v0.4.0
* @since 2022-04-19
+ * @since v0.4.0
*/
private Optional<DefaultPrefixRepetitionRule> getPresenterPrefixRule() {
final var prefixRule = this.presenter.getPrefixRepetitionRule();
@@ -769,8 +771,8 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
/**
* Determines which rounding type the presenter is currently using, if any.
*
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
private Optional<StandardRoundingType> getPresenterRoundingType() {
final var presenterRule = this.presenter.getNumberDisplayRule();
@@ -881,8 +883,8 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
* Sets the presenter's rounding rule to the one specified by the current
* settings
*
- * @since v0.4.0
* @since 2022-04-18
+ * @since v0.4.0
*/
private void updatePresenterRoundingRule() {
final Function<UncertainDouble, String> roundingRule;
diff --git a/src/main/java/sevenUnitsGUI/UnitConversionRecord.java b/src/main/java/sevenUnitsGUI/UnitConversionRecord.java
index 6dde230..958deae 100644
--- a/src/main/java/sevenUnitsGUI/UnitConversionRecord.java
+++ b/src/main/java/sevenUnitsGUI/UnitConversionRecord.java
@@ -24,8 +24,8 @@ import sevenUnits.unit.UnitValue;
/**
* A record of a conversion between units or expressions
*
- * @since v0.4.0
* @since 2022-04-09
+ * @since v0.4.0
*/
public final class UnitConversionRecord {
/**
@@ -34,8 +34,8 @@ public final class UnitConversionRecord {
* @param input input unit &amp; value
* @param output output unit &amp; value
* @return unit conversion record
- * @since v0.4.0
* @since 2022-04-09
+ * @since v0.4.0
*/
public static UnitConversionRecord fromLinearValues(LinearUnitValue input,
LinearUnitValue output) {
@@ -51,8 +51,8 @@ public final class UnitConversionRecord {
* @param input input unit &amp; value
* @param output output unit &amp; value
* @return unit conversion record
- * @since v0.4.0
* @since 2022-04-09
+ * @since v0.4.0
*/
public static UnitConversionRecord fromValues(UnitValue input,
UnitValue output) {
@@ -70,8 +70,8 @@ public final class UnitConversionRecord {
* @param inputValueString string representing input value
* @param outputValueString string representing output value
* @return unit conversion record
- * @since v0.4.0
* @since 2022-04-09
+ * @since v0.4.0
*/
public static UnitConversionRecord valueOf(String fromName, String toName,
String inputValueString, String outputValueString) {
@@ -106,6 +106,7 @@ public final class UnitConversionRecord {
* @param inputValueString string representing input value
* @param outputValueString string representing output value
* @since 2022-04-09
+ * @since v0.4.0
*/
private UnitConversionRecord(String fromName, String toName,
String inputValueString, String outputValueString) {
@@ -147,8 +148,8 @@ public final class UnitConversionRecord {
/**
* @return name of unit or expression that was converted from
- * @since v0.4.0
* @since 2022-04-09
+ * @since v0.4.0
*/
public String fromName() {
return this.fromName;
@@ -171,8 +172,8 @@ public final class UnitConversionRecord {
/**
* @return string representing input value
- * @since v0.4.0
* @since 2022-04-09
+ * @since v0.4.0
*/
public String inputValueString() {
return this.inputValueString;
@@ -180,8 +181,8 @@ public final class UnitConversionRecord {
/**
* @return string representing output value
- * @since v0.4.0
* @since 2022-04-09
+ * @since v0.4.0
*/
public String outputValueString() {
return this.outputValueString;
@@ -189,8 +190,8 @@ public final class UnitConversionRecord {
/**
* @return name of unit or expression that was converted to
- * @since v0.4.0
* @since 2022-04-09
+ * @since v0.4.0
*/
public String toName() {
return this.toName;
diff --git a/src/main/java/sevenUnitsGUI/UnitConversionView.java b/src/main/java/sevenUnitsGUI/UnitConversionView.java
index a6cc399..c7ffda4 100644
--- a/src/main/java/sevenUnitsGUI/UnitConversionView.java
+++ b/src/main/java/sevenUnitsGUI/UnitConversionView.java
@@ -23,57 +23,57 @@ import java.util.Set;
* A View that supports single unit-based conversion
*
* @author Adrien Hopkins
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
public interface UnitConversionView extends View {
/**
* @return dimensions available for filtering
- * @since v0.4.0
* @since 2022-01-29
+ * @since v0.4.0
*/
Set<String> getDimensionNames();
/**
* @return name of unit to convert <em>from</em>
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
Optional<String> getFromSelection();
/**
* @return list of names of units available to convert from
- * @since v0.4.0
* @since 2022-03-30
+ * @since v0.4.0
*/
Set<String> getFromUnitNames();
/**
* @return value to convert between the units (specifically, the numeric
* string provided by the user)
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
String getInputValue();
/**
* @return selected dimension
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
Optional<String> getSelectedDimensionName();
/**
* @return name of unit to convert <em>to</em>
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
Optional<String> getToSelection();
/**
* @return list of names of units available to convert to
- * @since v0.4.0
* @since 2022-03-30
+ * @since v0.4.0
*/
Set<String> getToUnitNames();
@@ -81,8 +81,8 @@ public interface UnitConversionView extends View {
* Sets the available dimensions for filtering.
*
* @param dimensionNames names of dimensions to use
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
void setDimensionNames(Set<String> dimensionNames);
@@ -92,8 +92,8 @@ public interface UnitConversionView extends View {
* that allow the user to select units from a list.
*
* @param unitNames names of units to convert from
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
void setFromUnitNames(Set<String> unitNames);
@@ -103,8 +103,8 @@ public interface UnitConversionView extends View {
* that allow the user to select units from a list.
*
* @param unitNames names of units to convert to
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
void setToUnitNames(Set<String> unitNames);
@@ -112,8 +112,8 @@ public interface UnitConversionView extends View {
* Shows the output of a unit conversion.
*
* @param uc record of unit conversion
- * @since v0.4.0
* @since 2021-12-24
+ * @since v0.4.0
*/
void showUnitConversionOutput(UnitConversionRecord uc);
}
diff --git a/src/main/java/sevenUnitsGUI/View.java b/src/main/java/sevenUnitsGUI/View.java
index f934bb5..fc04593 100644
--- a/src/main/java/sevenUnitsGUI/View.java
+++ b/src/main/java/sevenUnitsGUI/View.java
@@ -26,14 +26,14 @@ import sevenUnits.utils.NameSymbol;
* An object that controls user interaction with 7Units
*
* @author Adrien Hopkins
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
public interface View {
/**
* @return a new tabbed view
- * @since v0.4.0
* @since 2022-04-19
+ * @since v0.4.0
*/
static View createTabbedView() {
return new TabbedView();
@@ -41,22 +41,22 @@ public interface View {
/**
* @return the presenter associated with this view
- * @since v0.4.0
* @since 2022-04-19
+ * @since v0.4.0
*/
Presenter getPresenter();
/**
* @return name of prefix currently being viewed
- * @since v0.4.0
* @since 2022-04-10
+ * @since v0.4.0
*/
Optional<String> getViewedPrefixName();
/**
* @return name of unit currently being viewed
- * @since v0.4.0
* @since 2022-04-10
+ * @since v0.4.0
*/
Optional<String> getViewedUnitName();
@@ -65,8 +65,8 @@ public interface View {
* viewer
*
* @param prefixNames prefix names to view
- * @since v0.4.0
* @since 2022-04-10
+ * @since v0.4.0
*/
void setViewablePrefixNames(Set<String> prefixNames);
@@ -74,8 +74,8 @@ public interface View {
* Sets the list of units that are available to be viewed in a unit viewer
*
* @param unitNames unit names to view
- * @since v0.4.0
* @since 2022-04-10
+ * @since v0.4.0
*/
void setViewableUnitNames(Set<String> unitNames);
@@ -85,8 +85,8 @@ public interface View {
* @param title title of error message; on any view that uses an error
* dialog, this should be the title of the error dialog.
* @param message error message
- * @since v0.4.0
* @since 2021-12-15
+ * @since v0.4.0
*/
void showErrorMessage(String title, String message);
@@ -95,8 +95,8 @@ public interface View {
*
* @param name name(s) and symbol of prefix
* @param multiplierString string representation of prefix multiplier
- * @since v0.4.0
* @since 2022-04-10
+ * @since v0.4.0
*/
void showPrefix(NameSymbol name, String multiplierString);
@@ -107,8 +107,8 @@ public interface View {
* @param definition unit's definition string
* @param dimensionName name of unit's dimension
* @param type type of unit (metric/semi-metric/non-metric)
- * @since v0.4.0
* @since 2022-04-10
+ * @since v0.4.0
*/
void showUnit(NameSymbol name, String definition, String dimensionName,
UnitType type);
diff --git a/src/main/java/sevenUnitsGUI/ViewBot.java b/src/main/java/sevenUnitsGUI/ViewBot.java
index 8e24e64..689b460 100644
--- a/src/main/java/sevenUnitsGUI/ViewBot.java
+++ b/src/main/java/sevenUnitsGUI/ViewBot.java
@@ -32,8 +32,8 @@ import sevenUnits.utils.Nameable;
* for testing. Getters and setters work as expected.
*
* @author Adrien Hopkins
- * @since v0.4.0
* @since 2022-01-29
+ * @since v0.4.0
*/
public final class ViewBot
implements UnitConversionView, ExpressionConversionView {
@@ -42,6 +42,7 @@ public final class ViewBot
* {@link View#showPrefix(NameSymbol, String)}, for testing.
*
* @since 2022-04-16
+ * @since v0.4.0
*/
public static final class PrefixViewingRecord implements Nameable {
private final NameSymbol nameSymbol;
@@ -51,6 +52,7 @@ public final class ViewBot
* @param nameSymbol
* @param multiplierString
* @since 2022-04-16
+ * @since v0.4.0
*/
public PrefixViewingRecord(NameSymbol nameSymbol,
String multiplierString) {
@@ -106,6 +108,7 @@ public final class ViewBot
* {@link View#showUnit(NameSymbol, String, String, UnitType)}, for testing.
*
* @since 2022-04-16
+ * @since v0.4.0
*/
public static final class UnitViewingRecord implements Nameable {
private final NameSymbol nameSymbol;
@@ -119,6 +122,7 @@ public final class ViewBot
* @param dimensionName name of unit's dimension
* @param unitType type of unit (metric/semi-metric/non-metric)
* @since 2022-04-16
+ * @since v0.4.0
*/
public UnitViewingRecord(NameSymbol nameSymbol, String definition,
String dimensionName, UnitType unitType) {
@@ -131,6 +135,7 @@ public final class ViewBot
/**
* @return the definition
* @since 2022-04-16
+ * @since v0.4.0
*/
public String definition() {
return this.definition;
@@ -139,6 +144,7 @@ public final class ViewBot
/**
* @return the dimensionName
* @since 2022-04-16
+ * @since v0.4.0
*/
public String dimensionName() {
return this.dimensionName;
@@ -160,6 +166,7 @@ public final class ViewBot
/**
* @return the nameSymbol
* @since 2022-04-16
+ * @since v0.4.0
*/
@Override
public NameSymbol getNameSymbol() {
@@ -195,6 +202,7 @@ public final class ViewBot
/**
* @return the unitType
* @since 2022-04-16
+ * @since v0.4.0
*/
public UnitType unitType() {
return this.unitType;
@@ -243,6 +251,7 @@ public final class ViewBot
* Creates a new {@code ViewBot} with a new presenter.
*
* @since 2022-01-29
+ * @since v0.4.0
*/
public ViewBot() {
this.presenter = new Presenter(this);
@@ -256,6 +265,7 @@ public final class ViewBot
/**
* @return list of records of expression conversions done by this bot
* @since 2022-04-09
+ * @since v0.4.0
*/
public List<UnitConversionRecord> expressionConversionList() {
return Collections.unmodifiableList(this.expressionConversions);
@@ -264,6 +274,7 @@ public final class ViewBot
/**
* @return the available dimensions
* @since 2022-01-29
+ * @since v0.4.0
*/
@Override
public Set<String> getDimensionNames() {
@@ -283,6 +294,7 @@ public final class ViewBot
/**
* @return the units available for selection in From
* @since 2022-01-29
+ * @since v0.4.0
*/
@Override
public Set<String> getFromUnitNames() {
@@ -297,6 +309,7 @@ public final class ViewBot
/**
* @return the presenter associated with tihs view
* @since 2022-01-29
+ * @since v0.4.0
*/
@Override
public Presenter getPresenter() {
@@ -321,6 +334,7 @@ public final class ViewBot
/**
* @return the units available for selection in To
* @since 2022-01-29
+ * @since v0.4.0
*/
@Override
public Set<String> getToUnitNames() {
@@ -340,6 +354,7 @@ public final class ViewBot
/**
* @return list of records of this viewBot's prefix views
* @since 2022-04-16
+ * @since v0.4.0
*/
public List<PrefixViewingRecord> prefixViewList() {
return Collections.unmodifiableList(this.prefixViewingRecords);
@@ -357,6 +372,7 @@ public final class ViewBot
* @param fromExpression the expression to convert from
* @throws NullPointerException if {@code fromExpression} is null
* @since 2022-01-29
+ * @since v0.4.0
*/
public void setFromExpression(String fromExpression) {
this.fromExpression = Objects.requireNonNull(fromExpression,
@@ -366,6 +382,7 @@ public final class ViewBot
/**
* @param fromSelection the fromSelection to set
* @since 2022-01-29
+ * @since v0.4.0
*/
public void setFromSelection(Optional<String> fromSelection) {
this.fromSelection = Objects.requireNonNull(fromSelection,
@@ -375,6 +392,7 @@ public final class ViewBot
/**
* @param fromSelection the fromSelection to set
* @since 2022-02-10
+ * @since v0.4.0
*/
public void setFromSelection(String fromSelection) {
this.setFromSelection(Optional.of(fromSelection));
@@ -388,6 +406,7 @@ public final class ViewBot
/**
* @param inputValue the inputValue to set
* @since 2022-01-29
+ * @since v0.4.0
*/
public void setInputValue(String inputValue) {
this.inputValue = inputValue;
@@ -396,6 +415,7 @@ public final class ViewBot
/**
* @param selectedDimensionName the selectedDimensionName to set
* @since 2022-01-29
+ * @since v0.4.0
*/
public void setSelectedDimensionName(
Optional<String> selectedDimensionName) {
@@ -416,6 +436,7 @@ public final class ViewBot
* @param toExpression the expression to convert to
* @throws NullPointerException if {@code toExpression} is null
* @since 2022-01-29
+ * @since v0.4.0
*/
public void setToExpression(String toExpression) {
this.toExpression = Objects.requireNonNull(toExpression,
@@ -425,6 +446,7 @@ public final class ViewBot
/**
* @param toSelection unit set in the 'To' selection
* @since 2022-01-29
+ * @since v0.4.0
*/
public void setToSelection(Optional<String> toSelection) {
this.toSelection = Objects.requireNonNull(toSelection,
@@ -521,6 +543,7 @@ public final class ViewBot
/**
* @return list of records of every unit conversion made by this bot
* @since 2022-04-09
+ * @since v0.4.0
*/
public List<UnitConversionRecord> unitConversionList() {
return Collections.unmodifiableList(this.unitConversions);
@@ -529,6 +552,7 @@ public final class ViewBot
/**
* @return list of records of unit viewings made by this bot
* @since 2022-04-16
+ * @since v0.4.0
*/
public List<UnitViewingRecord> unitViewList() {
return Collections.unmodifiableList(this.unitViewingRecords);
diff --git a/src/main/java/sevenUnitsGUI/package-info.java b/src/main/java/sevenUnitsGUI/package-info.java
index c0ccc1b..74ec18c 100644
--- a/src/main/java/sevenUnitsGUI/package-info.java
+++ b/src/main/java/sevenUnitsGUI/package-info.java
@@ -19,5 +19,6 @@
*
* @author Adrien Hopkins
* @since 2021-12-15
+ * @since v0.4.0
*/
package sevenUnitsGUI; \ No newline at end of file