Examples of ExprException


Examples of org.boris.expr.ExprException

    }

    protected void assertMinArgCount(Expr[] args, int count)
            throws ExprException {
        if (args.length < count)
            throw new ExprException("Too few arguments to function " +
                    getClass().getSimpleName());
    }
View Full Code Here

Examples of org.boris.expr.ExprException

    }

    protected void assertMaxArgCount(Expr[] args, int count)
            throws ExprException {
        if (args.length > count)
            throw new ExprException("Too many arguments to function " +
                    getClass().getSimpleName());
    }
View Full Code Here

Examples of org.boris.expr.ExprException

        if (expr instanceof ExprArray) {
            return (ExprArray) expr;
        }

        if (strict)
            throw new ExprException("Argument not an array for function: " +
                    getClass().getSimpleName());

        ExprArray ea = new ExprArray(1, 1);
        ea.set(0, expr);
        return ea;
View Full Code Here

Examples of org.boris.expr.ExprException

        int y1 = dim1.getRow();
        int y2 = dim2 == null ? y1 : dim2.getRow();
        int width = x2 - x1 + 1;
        int height = y2 - y1 + 1;
        if (width <= 0 || height <= 0)
            throw new ExprException("Invalid range: " + range);
    }
View Full Code Here

Examples of org.boris.expr.ExprException

            ExprParser p = new ExprParser();
            p.setParserVisitor(this);
            try {
                p.parse(new ExprLexer(expression), this);
            } catch (IOException e) {
                throw new ExprException(e);
            }
            result = p.get();
        }
        return result;
    }
View Full Code Here

Examples of org.boris.expr.ExprException

                addDependencies(source, range);
            } catch (GraphCycleException ex) {
                for (ExprVariable v : vars) {
                    removeDependencies((Range) v.getAnnotation(), range);
                }
                throw new ExprException(ex);
            }
        }
    }
View Full Code Here

Examples of org.boris.expr.ExprException

        if (a instanceof ExprMissing)
            return;

        if (a instanceof ExprString) {
            if (strict)
                throw new ExprException("Unexpected argument for AVERAGE: " + a);
            else
                return;
        }

        if (a instanceof ExprDouble || a instanceof ExprInteger) {
            double d = ((ExprNumber) a).doubleValue();
            values[0] += d;
            values[1] += 1;
            return;
        }

        if (a instanceof ExprArray) {
            ExprArray arr = (ExprArray) a;
            int rows = arr.rows();
            int cols = arr.columns();
            for (int i = 0; i < rows; i++) {
                for (int j = 0; j < cols; j++) {
                    eval(arr.get(i, j), values, false);
                }
            }

            return;
        }

        throw new ExprException("Unexpected argument for AVERAGE: " + a);
    }
View Full Code Here

Examples of org.boris.expr.ExprException

public class AND extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        if (args.length == 0)
            throw new ExprException(
                    "AND function requires at least one argument");

        for (Expr a : args) {
            if (!eval(a, true))
                return ExprBoolean.FALSE;
View Full Code Here

Examples of org.boris.expr.ExprException

                }
            }
        }

        if (strict)
            throw new ExprException("Unexpected argument to " +
                    getClass().getSimpleName() + ": " + a);

        return false;
    }
View Full Code Here

Examples of org.boris.expr.ExprException

public class OR extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        if (args.length == 0)
            throw new ExprException(
                    "OR function requires at least one argument");

        for (Expr a : args) {
            if (eval(a, true))
                return ExprBoolean.TRUE;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.