Examples of ExprException


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

            }

            return ExprError.NAME;
        }

        throw new ExprException("Invalid argument for function COLUMN");
    }
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] += 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

Examples of org.boris.expr.ExprException

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

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] += 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

Examples of org.boris.expr.ExprException

public class CHOOSE extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        if (args.length < 2)
            throw new ExprException("Too few arguments for CHOOSE");

        Expr index = args[0];
        if (index instanceof ExprEvaluatable)
            index = ((ExprEvaluatable) index).evaluate();

        if (!(index instanceof ExprNumber)) {
            throw new ExprException(
                    "First argument must be a number for CHOOSE");
        }

        int idx = ((ExprNumber) index).intValue();
        if (idx < 1 || idx >= args.length)
            throw new ExprException("Invalid index for CHOOSE");

        return args[idx];
    }
View Full Code Here

Examples of org.boris.expr.ExprException

public class IF extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        if (args.length < 2)
            throw new ExprException("Too few arguments entered for function IF");
        if (args.length > 3)
            throw new ExprException(
                    "Too many arguments entered for function IF");

        Expr cond = evalArg(args[0]);
        Expr yRes = args[1];
        Expr nRes = null;
View Full Code Here

Examples of org.boris.expr.ExprException

        assertMinArgCount(args, 3);
        assertMaxArgCount(args, 5);

        Expr r = args[0];
        if (!(r instanceof ExprVariable)) {
            throw new ExprException("First argument to OFFSET not a reference");
        }

        ExprVariable ref = (ExprVariable) r;
        Range range = (Range) ref.getAnnotation();
        if (range == null) {
            range = Range.valueOf(ref.getName());
        }
        if (range == null) {
            throw new ExprException("First argument to OFFSET not a reference");
        }
        GridReference gf = range.getDimension1();
        int x = gf.getColumn();
        int y = gf.getRow();
        int rows = asInteger(args[1], 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.