Package org.boris.expr

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


        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

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

                }
            }
        }

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

        return false;
    }
View Full Code Here

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

                }
            }
        }

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

        return false;
    }
View Full Code Here

            }

            return ExprError.NAME;
        }

        throw new ExprException("Invalid argument for function COLUMN");
    }
View Full Code Here

        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] += Math.pow(average - d, 2);
            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), average, values, false);
                }
            }

            return;
        }

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

public class ADDRESS extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        if (args.length < 2 || args.length > 5)
            throw new ExprException("Invalid arguments to function ADDRESS");

        int row = asInteger(args[0], true);
        int col = asInteger(args[1], true);
        int abs = 1;
        if (args.length >= 3) {
View Full Code Here

        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] += Math.abs(average - 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), average, values, false);
                }
            }

            return;
        }

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

TOP

Related Classes of org.boris.expr.ExprException

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.