1
0
mirror of https://github.com/DanilaFe/abacus synced 2025-12-28 03:31:08 +00:00

Remove nullability from reduction.

This commit is contained in:
2017-09-07 12:53:12 -07:00
parent 1575d3e574
commit 52ab357fe1
17 changed files with 31 additions and 36 deletions

View File

@@ -15,6 +15,7 @@ import org.nwapw.abacus.config.Configuration;
import org.nwapw.abacus.function.Documentation;
import org.nwapw.abacus.function.DocumentationType;
import org.nwapw.abacus.function.DomainException;
import org.nwapw.abacus.function.EvaluationException;
import org.nwapw.abacus.number.*;
import org.nwapw.abacus.plugin.ClassFinder;
import org.nwapw.abacus.plugin.PluginListener;
@@ -147,16 +148,11 @@ public class AbacusController implements PluginListener {
}
EvaluationResult result = abacus.evaluateTree(constructedTree);
NumberInterface evaluatedNumber = result.getValue();
if (evaluatedNumber == null) {
return ERR_EVAL;
}
String resultingString = evaluatedNumber.toString();
historyData.add(new HistoryModel(inputField.getText(), constructedTree.toString(), resultingString));
abacus.applyToContext(result.getResultingContext());
return resultingString;
} catch (ComputationInterruptedException exception) {
return ERR_STOP;
} catch (DomainException exception) {
} catch (ComputationInterruptedException | DomainException | EvaluationException exception) {
return exception.getMessage();
} catch (RuntimeException exception) {
exception.printStackTrace();