1
0
mirror of https://github.com/DanilaFe/abacus synced 2026-09-25 12:52:33 +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

@@ -18,7 +18,7 @@ public class DomainException extends RuntimeException {
* Creates a new DomainException with a default message.
*/
public DomainException(){
this("Domain Error");
this("Domain error.");
}
}

View File

@@ -11,7 +11,7 @@ public class EvaluationException extends RuntimeException {
* Creates a new EvaluationException with the default string.
*/
public EvaluationException() {
super("Error evaluating expression.");
super("Evaluation error.");
}
/**

View File

@@ -10,7 +10,7 @@ public class ComputationInterruptedException extends RuntimeException {
* Creates a new exception of this type.
*/
public ComputationInterruptedException() {
super("Computation interrupted by user.");
super("Computation interrupted.");
}
}

View File

@@ -29,8 +29,7 @@ public class StandardPlugin extends Plugin {
@Override
public NumberInterface applyInternal(MutableEvaluationContext context, TreeNode[] params) {
String assignTo = ((VariableNode) params[0]).getVariable();
NumberInterface value = params[1].reduce(context.getReducer());
if(value == null) throw new EvaluationException();
NumberInterface value = params[1].reduce(context.getInheritedReducer());
context.setVariable(assignTo, value);
return value;
}
@@ -48,9 +47,7 @@ public class StandardPlugin extends Plugin {
public NumberInterface applyInternal(MutableEvaluationContext context, TreeNode[] params) {
String assignTo = ((VariableNode) params[0]).getVariable();
context.setDefinition(assignTo, params[1]);
NumberInterface value = params[1].reduce(context.getReducer());
if(value == null) throw new EvaluationException();
return value;
return params[1].reduce(context.getInheritedReducer());
}
};
/**