Search in sources :

Example 1 with ISymbolEvaluator

use of org.matheclipse.core.eval.interfaces.ISymbolEvaluator in project symja_android_library by axkr.

the class BuiltInSymbol method evaluate.

/** {@inheritDoc} */
@Override
public IExpr evaluate(EvalEngine engine) {
    if (hasLocalVariableStack()) {
        return IExpr.ofNullable(get());
    }
    IExpr result;
    if ((result = evalDownRule(engine, this)).isPresent()) {
        return result;
    }
    final IEvaluator module = getEvaluator();
    if (module instanceof ISymbolEvaluator) {
        IExpr temp;
        if (engine.isNumericMode()) {
            if (engine.isApfloat()) {
                temp = ((ISymbolEvaluator) module).apfloatEval(this, engine);
            } else {
                temp = ((ISymbolEvaluator) module).numericEval(this);
            }
        } else {
            temp = ((ISymbolEvaluator) module).evaluate(this);
        }
        return temp;
    }
    return F.NIL;
}
Also used : IEvaluator(org.matheclipse.core.interfaces.IEvaluator) IExpr(org.matheclipse.core.interfaces.IExpr) ISymbolEvaluator(org.matheclipse.core.eval.interfaces.ISymbolEvaluator)

Aggregations

ISymbolEvaluator (org.matheclipse.core.eval.interfaces.ISymbolEvaluator)1 IEvaluator (org.matheclipse.core.interfaces.IEvaluator)1 IExpr (org.matheclipse.core.interfaces.IExpr)1