Package org.boris.expr

Examples of org.boris.expr.ExprArray


            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;
        }
View Full Code Here


        }

        if (arg instanceof ExprNumber) {
            return Math.pow(((ExprNumber) arg).doubleValue(), 2);
        } else if (arg instanceof ExprArray) {
            ExprArray a = (ExprArray) arg;
            int rows = a.rows();
            int cols = a.columns();
            double res = 0;
            for (int i = 0; i < rows; i++) {
                for (int j = 0; j < cols; j++) {
                    res += sumsq(a.get(i, j));
                }
            }
            return res;
        }
View Full Code Here

public class FunctionTestRange extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);

        ExprArray arr = new ExprArray(4, 4);
        for (int i = 0; i < arr.rows(); i++) {
            for (int j = 0; j < arr.columns(); j++) {
                arr.set(i, j, new ExprDouble((i + 1) * (j + 1)));
            }
        }
        return arr;
    }
View Full Code Here

        if (a instanceof ExprMissing)
            return true;

        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++) {
                    if (!eval(arr.get(i, j), false))
                        return false;
                }
            }
        }
View Full Code Here

{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);
        Expr a = evalArg(args[0]);
        if (a instanceof ExprArray) {
            ExprArray ar = (ExprArray) a;
            a = ar.get(0);
        }
        if (a instanceof ExprNumber) {
            return new ExprDouble(((ExprNumber) a).doubleValue());
        }
        return ExprDouble.ZERO;
View Full Code Here

        }

        if (arg instanceof ExprNumber) {
            return ((ExprNumber) arg).doubleValue();
        } else if (arg instanceof ExprArray) {
            ExprArray a = (ExprArray) arg;
            int rows = a.rows();
            int cols = a.columns();
            double res = 0;
            for (int i = 0; i < rows; i++) {
                for (int j = 0; j < cols; j++) {
                    res += sum(a.get(i, j));
                }
            }
            return res;
        }
        return 0;
View Full Code Here

        if (arg instanceof ExprMissing) {
            return 1;
        } else if (arg instanceof ExprArray) {
            int count = 0;
            ExprArray arr = (ExprArray) arg;
            int rows = arr.rows();
            int cols = arr.columns();
            for (int i = 0; i < rows; i++) {
                for (int j = 0; j < cols; j++) {
                    count += count(arr.get(i, j));
                }
            }
            return count;
        } else {
            return 0;
View Full Code Here

        if (a instanceof ExprMissing)
            return false;

        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++) {
                    if (eval(arr.get(i, j), false))
                        return true;
                }
            }
        }
View Full Code Here

            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;
        }
View Full Code Here

        Expr eX = evalArg(args[2]);
        if (!(eX instanceof ExprArray))
            return ExprError.VALUE;

        double forecastX = ((ExprNumber) eF).doubleValue();
        ExprArray knownY = (ExprArray) eY;
        ExprArray knownX = (ExprArray) eX;
        if (knownY.length() != knownX.length())
            return ExprError.NA;

        Expr aeY = AVERAGE.average(knownY);
        if (aeY instanceof ExprError)
            return aeY;
View Full Code Here

TOP

Related Classes of org.boris.expr.ExprArray

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.