Numeral system converter

This commit is contained in:
serso
2016-04-19 22:45:37 +02:00
parent f066e84250
commit ae4c7ec11f
18 changed files with 259 additions and 68 deletions

View File

@@ -144,12 +144,12 @@ public class JsclMathEngine implements MathEngine {
}
@Nonnull
public String format(double value) throws NumeralBaseException {
public String format(double value) {
return format(value, numeralBase);
}
@Nonnull
public String format(double value, @Nonnull NumeralBase nb) throws NumeralBaseException {
public String format(double value, @Nonnull NumeralBase nb) {
if (Double.isInfinite(value)) {
return formatInfinity(value);
}
@@ -189,12 +189,12 @@ public class JsclMathEngine implements MathEngine {
}
@Override
public String format(@Nonnull BigInteger value) throws NumeralBaseException {
public String format(@Nonnull BigInteger value) {
return format(value, numeralBase);
}
@Nonnull
public String format(@Nonnull BigInteger value, @Nonnull NumeralBase nb) throws NumeralBaseException {
public String format(@Nonnull BigInteger value, @Nonnull NumeralBase nb) {
if (nb == NumeralBase.dec) {
if (BigInteger.ZERO.equals(value)) {
return "0";

View File

@@ -45,12 +45,12 @@ public interface MathContext {
void setGroupingSeparator(char groupingSeparator);
@Nonnull
String format(double value) throws NumeralBaseException;
String format(double value);
String format(@Nonnull BigInteger value) throws NumeralBaseException;
String format(@Nonnull BigInteger value);
@Nonnull
String format(double value, @Nonnull NumeralBase nb) throws NumeralBaseException;
String format(double value, @Nonnull NumeralBase nb);
@Nonnull
String addGroupingSeparators(@Nonnull NumeralBase nb, @Nonnull String ungroupedIntValue);

View File

@@ -1,12 +0,0 @@
package jscl;
import jscl.text.msg.Messages;
import javax.annotation.Nonnull;
public class NumeralBaseException extends JsclArithmeticException {
public NumeralBaseException(@Nonnull Double value) {
super(Messages.msg_17, value);
}
}