Package org.boris.expr

Examples of org.boris.expr.Expr


        }
        return e;
    }

    public static Expr parseValue(String expression) {
        Expr result;
        try {
            result = new ExprInteger(Integer.parseInt(expression));
        } catch (Exception e) {
            try {
                result = new ExprDouble(Double.parseDouble(expression));
View Full Code Here


            return MISSING;
        }

        String ns = r.getNamespace();
        if (ns != null && !ns.equals(namespace)) {
            Expr e = provider.evaluateVariable(variable);
            if (e == null)
                e = MISSING;
            return e;
        } else {

            Expr e = values.get(r);
            if (e == null) {
                // TODO: think about external variables versus missing
                e = provider.evaluateVariable(variable);
                if (e == null)
                    e = MISSING;
View Full Code Here

        if (width <= 0 || height <= 0)
            throw new ExprException("Invalid range: " + range);
    }

    protected Expr parseExpression(String expression) throws ExprException {
        Expr result;
        if (!expression.startsWith("=")) {
            result = Exprs.parseValue(expression);
        } else {
            expression = expression.substring(1);
            ExprParser p = new ExprParser();
View Full Code Here

    public Expr evaluateFunction(ExprFunction function) throws ExprException {
        return delegate.evaluateFunction(function);
    }

    public Expr evaluateVariable(ExprVariable variable) throws ExprException {
        Expr var = variables.get(variable.getName());
        if (var != null) {
            return var;
        } else {
            return delegate.evaluateVariable(variable);
        }
View Full Code Here

        Set<Range> inputs = getInputRanges();
        Map<Range, Expr> valueChanges = new HashMap();
        for (int i = 0; i < maxIterations; i++) {
            double change = 0;
            for (Range r : inputs) {
                Expr e = inputExprs.get(r);
                if (e instanceof ExprEvaluatable) {
                    e = ((ExprEvaluatable) e).evaluate();
                    values.put(r, e);
                    valueChanges.put(r, e);
                    double c = findChange(values.get(r), e);
View Full Code Here

            return;
        }

        rawInputs.put(range, expression);

        Expr expr = parseExpression(expression);
        inputExprs.put(range, expr);

        // Set the inputs
        provider.inputChanged(range, expr);
        inputs.put(range, expr);

        // Always evaluate the expression entered
        if (expr.evaluatable) {
            Expr eval = ((ExprEvaluatable) expr).evaluate();
            provider.valueChanged(range, eval);
            values.put(range, eval);
        } else {
            provider.valueChanged(range, expr);
            values.put(range, expr);
View Full Code Here

        } else if (vals instanceof ExprArray) {
            ExprArray a = (ExprArray) vals;
            double[] arr = new double[a.length()];
            int index = 0;
            for (int i = 0; i < arr.length; i++) {
                Expr e = evalArg(a.get(i));
                if (e instanceof ExprNumber) {
                    arr[index++] = ((ExprNumber) e).doubleValue();
                }
            }
            if (arr.length == index)
View Full Code Here

        // Generate map of column name to value for each row
        Map<String, Condition>[] dr = new HashMap[rows - 1];
        for (int i = 1; i < rows; i++) {
            dr[i - 1] = new HashMap();
            for (int j = 0; j < cols; j++) {
                Expr e = array.get(i, j);
                Condition c = dr[i - 1].get(dc[j]);
                if (c != null) {
                    c.add(Condition.valueOf(e));
                } else {
                    dr[i - 1].put(dc[j], Condition.valueOf(e));
View Full Code Here

    public void removeListener(IEngineListener listener) {
        listeners.remove(listener);
    }

    public void set(String name, String expression) throws IOException, ExprException {
        Expr input = ExprParser.parse(expression, this);
        set(name, input);
    }
View Full Code Here

public class INDIRECT extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertMinArgCount(args, 1);
        assertMaxArgCount(args, 2);
        Expr ref = evalArg(args[0]);

        return null;
    }
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.