summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnitsGUI/TabbedView.java
diff options
context:
space:
mode:
authorAdrien Hopkins <ahopk127@my.yorku.ca>2022-04-19 16:35:43 -0500
committerAdrien Hopkins <ahopk127@my.yorku.ca>2022-04-19 16:35:43 -0500
commit8cc60583134a4d01e9967424e5a51332de6cc38b (patch)
treeaf3bb8662dd4203fcfbd071f005e0619096f61ee /src/main/java/sevenUnitsGUI/TabbedView.java
parent0aacba9fc8a9140fdf331172ad66afe280d09b5e (diff)
Finalized version 0.4.0-alpha.1
Diffstat (limited to 'src/main/java/sevenUnitsGUI/TabbedView.java')
-rw-r--r--src/main/java/sevenUnitsGUI/TabbedView.java76
1 files changed, 3 insertions, 73 deletions
diff --git a/src/main/java/sevenUnitsGUI/TabbedView.java b/src/main/java/sevenUnitsGUI/TabbedView.java
index c8e69ee..be80ccb 100644
--- a/src/main/java/sevenUnitsGUI/TabbedView.java
+++ b/src/main/java/sevenUnitsGUI/TabbedView.java
@@ -124,87 +124,17 @@ final class TabbedView implements ExpressionConversionView, UnitConversionView {
* Rounds to a fixed number of significant digits. Precision is used,
* representing the number of significant digits to round to.
*/
- SIGNIFICANT_DIGITS(true) {
- @Override
- public Function<UncertainDouble, String> getRuleFromPrecision(
- int precision) {
- return StandardDisplayRules.fixedPrecision(precision);
- }
- },
+ SIGNIFICANT_DIGITS,
/**
* Rounds to a fixed number of decimal places. Precision is used,
* representing the number of decimal places to round to.
*/
- DECIMAL_PLACES(true) {
- @Override
- public Function<UncertainDouble, String> getRuleFromPrecision(
- int precision) {
- return StandardDisplayRules.fixedDecimals(precision);
- }
- },
+ DECIMAL_PLACES,
/**
* Rounds according to UncertainDouble's toString method. The specified
* precision is ignored.
*/
- UNCERTAINTY(false) {
- @Override
- public Function<UncertainDouble, String> getRuleFromPrecision(
- int precision) {
- return StandardDisplayRules.uncertaintyBased();
- }
- };
-
- /**
- * If true, this type of rounding rule requires you to specify a
- * precision.
- */
- private final boolean requiresPrecision;
-
- /**
- * @param canCustomizePrecision
- * @since 2022-04-18
- */
- private StandardRoundingType(boolean requiresPrecision) {
- this.requiresPrecision = requiresPrecision;
- }
-
- /**
- * Gets a rounding rule of this type.
- *
- * @param precision the rounding type's precision. If
- * {@link #requiresPrecision} is false, this field will
- * be ignored.
- * @return rounding rule
- * @since 2022-04-18
- */
- public abstract Function<UncertainDouble, String> getRuleFromPrecision(
- int precision);
-
- /**
- * Tries to get this rule without specifying precision.
- *
- * @throws UnsupportedOperationException if this rule requires specifying
- * precision
- * @since 2022-04-18
- */
- public final Function<UncertainDouble, String> getRuleWithoutPrecision() {
- if (this.requiresPrecision())
- throw new UnsupportedOperationException("Rounding type " + this
- + " requires you to specify precision.");
- else
- // random number to mess with anyone who lies about whether or not
- // precision is required
- return this.getRuleFromPrecision(-623546735);
- }
-
- /**
- * @return whether or not this rounding type requires you to specify an
- * integer precision
- * @since 2022-04-18
- */
- public boolean requiresPrecision() {
- return this.requiresPrecision;
- }
+ UNCERTAINTY;
}
/**