diff options
Diffstat (limited to 'src/main/java/sevenUnitsGUI/TabbedView.java')
-rw-r--r-- | src/main/java/sevenUnitsGUI/TabbedView.java | 76 |
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; } /** |