Package org.boris.expr

Examples of org.boris.expr.Expr


    }

    private class EngineFunctionManager extends FunctionManager
    {
        public Expr evaluateVariable(ExprVariable variable) throws ExprException {
            Expr v = results.get(variable.getName());
            return v == null ? ExprError.NAME : v;
        }
View Full Code Here


        throw new ExprException("Invalid argument type for function " +
                getClass().getSimpleName());
    }
   
    protected String asString(Expr[] args, int index, String defaultValue) throws ExprException {
        Expr arg = getArg(args, index);
        return arg == null ? defaultValue : arg.toString();
    }
View Full Code Here

        Expr arg = getArg(args, index);
        return arg == null ? defaultValue : arg.toString();
    }
   
    protected int asInteger(Expr[] args, int index, int defaultValue) throws ExprException {
        Expr arg = getArg(args, index);
        if(arg instanceof ExprNumber)
            return ((ExprNumber)arg).intValue();
        return defaultValue;
    }
View Full Code Here

            return ((ExprNumber)arg).intValue();
        return defaultValue;
    }
   
    protected double asDouble(Expr[] args, int index, double defaultValue) throws ExprException {
        Expr arg = getArg(args, index);
        if(arg instanceof ExprNumber)
            return ((ExprNumber)arg).doubleValue();
        return defaultValue;
    }
View Full Code Here

   
    protected Expr getArg(Expr[] args, int index) throws ExprException {
        if(args == null || args.length <= index)
            return null;
       
        Expr arg = args[index];
        if(arg instanceof ExprArray) {
            arg = ((ExprArray)arg).get(0);
        }
        if (arg instanceof ExprEvaluatable) {
            arg = ((ExprEvaluatable) arg).evaluate();
View Full Code Here

    protected double asDouble(ExprArray knownY, int index) throws ExprException {
        if (index < 0 || index >= knownY.length())
            return 0;

        Expr e = knownY.get(index);
        return asDouble(e, false);
    }
View Full Code Here

            return vectorLookup(args);
        }
    }

    public static Expr vectorLookup(Expr[] args) throws ExprException {
        Expr ev = evalArg(args[0]);
        Expr el = evalArg(args[1]);
        Expr er = evalArg(args[2]);
        return null;
    }
View Full Code Here

            }

            return ExprError.NAME;
        }

        Expr a = args[0];
        if (a instanceof ExprEvaluatable) {
            a = ((ExprEvaluatable) a).evaluate();
        }

        if (a instanceof ExprInteger || a instanceof ExprDouble) {
View Full Code Here

public class TIME extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 3);
        Expr eH = evalArg(args[0]);
        if (!isNumber(eH))
            return ExprError.VALUE;
        double h = ((ExprNumber) eH).doubleValue();
        Expr eM = evalArg(args[1]);
        if (!isNumber(eM))
            return ExprError.VALUE;
        double m = ((ExprNumber) eM).doubleValue();
        Expr eS = evalArg(args[1]);
        if (!isNumber(eS))
            return ExprError.VALUE;
        double s = ((ExprNumber) eS).doubleValue();
        double r = ExcelDate.time(h, m, s);
        if (r < 0)
View Full Code Here

public class ISERR extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);
        Expr e = evalArg(args[0]);
        return bool(e instanceof ExprError);
    }
View Full Code Here

TOP

Related Classes of org.boris.expr.Expr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.