functions

This commit is contained in:
Sergey Solovyev
2012-11-14 23:44:11 +04:00
parent 75a3a72a84
commit b91c8bc19d
6 changed files with 99 additions and 101 deletions

View File

@@ -6,6 +6,7 @@
package org.solovyev.android.calculator;
import jscl.CustomFunctionCalculationException;
import jscl.math.function.CustomFunction;
import jscl.math.function.Function;
import org.jetbrains.annotations.NotNull;
@@ -52,7 +53,7 @@ public class CalculatorFunctionsMathRegistry extends AbstractCalculatorMathRegis
public static void saveFunction(@NotNull CalculatorMathRegistry<Function> registry,
@NotNull MathEntityBuilder<? extends Function> builder,
@Nullable Function editedInstance,
@NotNull Object source, boolean save) {
@NotNull Object source, boolean save) throws CustomFunctionCalculationException {
final Function addedFunction = registry.add(builder);
if (save) {

View File

@@ -411,6 +411,21 @@ public class CalculatorImpl implements Calculator, CalculatorEventListener {
onDisplayStateChanged((CalculatorDisplayChangeEventData) data);
break;
case constant_changed:
final IConstant newConstant = ((Change<IConstant>)data) .getNewValue();
if (!newConstant.getName().equals(CalculatorVarsRegistry.ANS)) {
evaluate();
}
break;
case constant_added:
case constant_removed:
case function_added:
case function_changed:
case function_removed:
evaluate();
break;
case engine_preferences_changed:
evaluate(calculatorEventData.getSequenceId());
break;

View File

@@ -84,9 +84,6 @@ public enum FunctionCategory {
}
});
// todo serso: current solution (as creating functions is not implemented yet)
result.remove(my);
return result;
}
}