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:
@@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
};
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user