From 26291e672b0e683edc9d57710a9a9d96ca199c45 Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Sun, 24 Mar 2024 13:14:11 -0500 Subject: Format source code & set explicit UTF-8 --- src/main/java/sevenUnitsGUI/ViewBot.java | 126 +++++++++++++++---------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'src/main/java/sevenUnitsGUI/ViewBot.java') diff --git a/src/main/java/sevenUnitsGUI/ViewBot.java b/src/main/java/sevenUnitsGUI/ViewBot.java index e7304c4..e6593fb 100644 --- a/src/main/java/sevenUnitsGUI/ViewBot.java +++ b/src/main/java/sevenUnitsGUI/ViewBot.java @@ -46,7 +46,7 @@ public final class ViewBot public static final class PrefixViewingRecord implements Nameable { private final NameSymbol nameSymbol; private final String multiplierString; - + /** * @param nameSymbol * @param multiplierString @@ -57,7 +57,7 @@ public final class ViewBot this.nameSymbol = nameSymbol; this.multiplierString = multiplierString; } - + @Override public boolean equals(Object obj) { if (this == obj) @@ -68,25 +68,25 @@ public final class ViewBot return Objects.equals(this.multiplierString, other.multiplierString) && Objects.equals(this.nameSymbol, other.nameSymbol); } - + @Override public NameSymbol getNameSymbol() { return this.nameSymbol; } - + @Override public int hashCode() { return Objects.hash(this.multiplierString, this.nameSymbol); } - + public String multiplierString() { return this.multiplierString; } - + public NameSymbol nameSymbol() { return this.nameSymbol; } - + @Override public String toString() { final StringBuilder builder = new StringBuilder(); @@ -98,7 +98,7 @@ public final class ViewBot return builder.toString(); } } - + /** * A record of the parameters given to * {@link View#showUnit(NameSymbol, String, String, UnitType)}, for testing. @@ -110,7 +110,7 @@ public final class ViewBot private final String definition; private final String dimensionName; private final UnitType unitType; - + /** * @since 2022-04-16 */ @@ -121,7 +121,7 @@ public final class ViewBot this.dimensionName = dimensionName; this.unitType = unitType; } - + /** * @return the definition * @since 2022-04-16 @@ -129,7 +129,7 @@ public final class ViewBot public String definition() { return this.definition; } - + /** * @return the dimensionName * @since 2022-04-16 @@ -137,7 +137,7 @@ public final class ViewBot public String dimensionName() { return this.dimensionName; } - + @Override public boolean equals(Object obj) { if (this == obj) @@ -150,7 +150,7 @@ public final class ViewBot && Objects.equals(this.nameSymbol, other.nameSymbol) && this.unitType == other.unitType; } - + /** * @return the nameSymbol * @since 2022-04-16 @@ -159,17 +159,17 @@ public final class ViewBot public NameSymbol getNameSymbol() { return this.nameSymbol; } - + @Override public int hashCode() { return Objects.hash(this.definition, this.dimensionName, this.nameSymbol, this.unitType); } - + public NameSymbol nameSymbol() { return this.nameSymbol; } - + @Override public String toString() { final StringBuilder builder = new StringBuilder(); @@ -184,7 +184,7 @@ public final class ViewBot builder.append("]"); return builder.toString(); } - + /** * @return the unitType * @since 2022-04-16 @@ -193,10 +193,10 @@ public final class ViewBot return this.unitType; } } - + /** The presenter that works with this ViewBot */ private final Presenter presenter; - + /** The dimensions available to select from */ private Set dimensionNames = Set.of(); /** The expression in the From field */ @@ -217,12 +217,12 @@ public final class ViewBot private Set fromUnits = Set.of(); /** The units available in the To selection */ private Set toUnits = Set.of(); - + /** The selected unit in the unit viewer */ private Optional unitViewerSelection = Optional.empty(); /** The selected unit in the prefix viewer */ private Optional prefixViewerSelection = Optional.empty(); - + /** Saved outputs of all unit conversions */ private final List unitConversions; /** Saved outputs of all unit expressions */ @@ -231,7 +231,7 @@ public final class ViewBot private final List unitViewingRecords; /** Saved outputs of all prefix viewings */ private final List prefixViewingRecords; - + /** * Creates a new {@code ViewBot} with a new presenter. * @@ -239,13 +239,13 @@ public final class ViewBot */ public ViewBot() { this.presenter = new Presenter(this); - + this.unitConversions = new ArrayList<>(); this.expressionConversions = new ArrayList<>(); this.unitViewingRecords = new ArrayList<>(); this.prefixViewingRecords = new ArrayList<>(); } - + /** * @return list of records of expression conversions done by this bot * @since 2022-04-09 @@ -253,7 +253,7 @@ public final class ViewBot public List expressionConversionList() { return Collections.unmodifiableList(this.expressionConversions); } - + /** * @return the available dimensions * @since 2022-01-29 @@ -262,17 +262,17 @@ public final class ViewBot public Set getDimensionNames() { return this.dimensionNames; } - + @Override public String getFromExpression() { return this.fromExpression; } - + @Override public Optional getFromSelection() { return this.fromSelection; } - + /** * @return the units available for selection in From * @since 2022-01-29 @@ -281,12 +281,12 @@ public final class ViewBot public Set getFromUnitNames() { return Collections.unmodifiableSet(this.fromUnits); } - + @Override public String getInputValue() { return this.inputValue; } - + /** * @return the presenter associated with tihs view * @since 2022-01-29 @@ -295,22 +295,22 @@ public final class ViewBot public Presenter getPresenter() { return this.presenter; } - + @Override public Optional getSelectedDimensionName() { return this.selectedDimensionName; } - + @Override public String getToExpression() { return this.toExpression; } - + @Override public Optional getToSelection() { return this.toSelection; } - + /** * @return the units available for selection in To * @since 2022-01-29 @@ -319,17 +319,17 @@ public final class ViewBot public Set getToUnitNames() { return Collections.unmodifiableSet(this.toUnits); } - + @Override public Optional getViewedPrefixName() { return this.prefixViewerSelection; } - + @Override public Optional getViewedUnitName() { return this.unitViewerSelection; } - + /** * @return list of records of this viewBot's prefix views * @since 2022-04-16 @@ -337,13 +337,13 @@ public final class ViewBot public List prefixViewList() { return Collections.unmodifiableList(this.prefixViewingRecords); } - + @Override public void setDimensionNames(Set dimensionNames) { this.dimensionNames = Objects.requireNonNull(dimensionNames, "dimensions may not be null"); } - + /** * Sets the From expression (as in {@link #getFromExpression}). * @@ -355,7 +355,7 @@ public final class ViewBot this.fromExpression = Objects.requireNonNull(fromExpression, "fromExpression cannot be null."); } - + /** * @param fromSelection the fromSelection to set * @since 2022-01-29 @@ -364,7 +364,7 @@ public final class ViewBot this.fromSelection = Objects.requireNonNull(fromSelection, "fromSelection cannot be null"); } - + /** * @param fromSelection the fromSelection to set * @since 2022-02-10 @@ -372,12 +372,12 @@ public final class ViewBot public void setFromSelection(String fromSelection) { this.setFromSelection(Optional.of(fromSelection)); } - + @Override public void setFromUnitNames(Set units) { this.fromUnits = Objects.requireNonNull(units, "units may not be null"); } - + /** * @param inputValue the inputValue to set * @since 2022-01-29 @@ -385,7 +385,7 @@ public final class ViewBot public void setInputValue(String inputValue) { this.inputValue = inputValue; } - + /** * @param selectedDimension the selectedDimension to set * @since 2022-01-29 @@ -394,11 +394,11 @@ public final class ViewBot Optional selectedDimensionName) { this.selectedDimensionName = selectedDimensionName; } - + public void setSelectedDimensionName(String selectedDimensionName) { this.setSelectedDimensionName(Optional.of(selectedDimensionName)); } - + /** * Sets the To expression (as in {@link #getToExpression}). * @@ -410,7 +410,7 @@ public final class ViewBot this.toExpression = Objects.requireNonNull(toExpression, "toExpression cannot be null."); } - + /** * @param toSelection the toSelection to set * @since 2022-01-29 @@ -419,77 +419,77 @@ public final class ViewBot this.toSelection = Objects.requireNonNull(toSelection, "toSelection cannot be null."); } - + public void setToSelection(String toSelection) { this.setToSelection(Optional.of(toSelection)); } - + @Override public void setToUnitNames(Set units) { this.toUnits = Objects.requireNonNull(units, "units may not be null"); } - + @Override public void setViewablePrefixNames(Set prefixNames) { // do nothing, ViewBot supports selecting any prefix } - + @Override public void setViewableUnitNames(Set unitNames) { // do nothing, ViewBot supports selecting any unit } - + public void setViewedPrefixName(Optional viewedPrefixName) { this.prefixViewerSelection = viewedPrefixName; } - + public void setViewedPrefixName(String viewedPrefixName) { this.setViewedPrefixName(Optional.of(viewedPrefixName)); } - + public void setViewedUnitName(Optional viewedUnitName) { this.unitViewerSelection = viewedUnitName; } - + public void setViewedUnitName(String viewedUnitName) { this.setViewedUnitName(Optional.of(viewedUnitName)); } - + @Override public void showErrorMessage(String title, String message) { System.err.printf("%s: %s%n", title, message); } - + @Override public void showExpressionConversionOutput(UnitConversionRecord uc) { this.expressionConversions.add(uc); System.out.println("Expression Conversion: " + uc); } - + @Override public void showPrefix(NameSymbol name, String multiplierString) { this.prefixViewingRecords .add(new PrefixViewingRecord(name, multiplierString)); } - + @Override public void showUnit(NameSymbol name, String definition, String dimensionName, UnitType type) { this.unitViewingRecords .add(new UnitViewingRecord(name, definition, dimensionName, type)); } - + @Override public void showUnitConversionOutput(UnitConversionRecord uc) { this.unitConversions.add(uc); System.out.println("Unit Conversion: " + uc); } - + @Override public String toString() { return super.toString() + String.format("[presenter=%s]", this.presenter); } - + /** * @return list of records of every unit conversion made by this bot * @since 2022-04-09 @@ -497,7 +497,7 @@ public final class ViewBot public List unitConversionList() { return Collections.unmodifiableList(this.unitConversions); } - + /** * @return list of records of unit viewings made by this bot * @since 2022-04-16 -- cgit v1.2.3