Package org.boris.expr

Examples of org.boris.expr.ExprInteger


        switch (e.type) {
        case Decimal:
            value = new ExprDouble(e.doubleValue);
            break;
        case Integer:
            value = new ExprInteger(e.integerValue);
            break;
        case String:
            value = new ExprString(e.val);
            break;
        case Variable:
View Full Code Here


    public void setValue(String name, double value) {
        setValue(name, new ExprDouble(value));
    }

    public void setValue(String name, int value) throws GraphCycleException {
        setValue(name, new ExprInteger(value));
    }
View Full Code Here

            }
            if (r != null && r.getDimension1() != null) {
                GridReference dim1 = r.getDimension1();
                GridReference dim2 = r.getDimension2();
                if (dim2 == null) {
                    return new ExprInteger(1);
                } else {
                    if (cols) {
                        return new ExprInteger(Math.abs(dim2.getColumn() -
                                dim1.getColumn()) + 1);
                    } else {
                        return new ExprInteger(Math.abs(dim2.getRow() -
                                dim1.getRow()) + 1);
                    }
                }
            }

            return ExprError.NAME;
        }

        Expr a = args[0];
        if (a instanceof ExprEvaluatable) {
            a = ((ExprEvaluatable) a).evaluate();
        }

        if (a instanceof ExprInteger || a instanceof ExprDouble) {
            return new ExprInteger(1);
        }

        if (a instanceof ExprError) {
            return a;
        }
View Full Code Here

    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);

        if (args[0] instanceof ExprError) {
            if (ExprError.NULL.equals(args[0])) {
                return new ExprInteger(1);
            } else if (ExprError.DIV0.equals(args[0])) {
                return new ExprInteger(2);
            } else if (ExprError.VALUE.equals(args[0])) {
                return new ExprInteger(3);
            } else if (ExprError.REF.equals(args[0])) {
                return new ExprInteger(4);
            } else if (ExprError.NAME.equals(args[0])) {
                return new ExprInteger(5);
            } else if (ExprError.NUM.equals(args[0])) {
                return new ExprInteger(6);
            } else if (ExprError.NA.equals(args[0])) {
                return new ExprInteger(7);
            }
        }

        return ExprError.NA;
    }
View Full Code Here

            Range r = (Range) v.getAnnotation();
            if (r == null) {
                r = Range.valueOf(v.getName());
            }
            if (r != null && r.getDimension1() != null) {
                return new ExprInteger(r.getDimension1().getRow());
            }

            return ExprError.NAME;
        }
View Full Code Here

    }

    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));
            } catch (Exception ex) {
                result = new ExprString(expression);
View Full Code Here

        if (o instanceof Double)
            return new ExprDouble(((Double) o).doubleValue());

        if (o instanceof Integer)
            return new ExprInteger(((Integer) o).intValue());

        if (o instanceof Boolean)
            return new ExprBoolean(((Boolean) o).booleanValue());

        if (o instanceof String)
View Full Code Here

        assertMinArgCount(args, 1);
        int count = 0;
        for (Expr a : args) {
            count += count(a, false);
        }
        return new ExprInteger(count);
    }
View Full Code Here

        assertMinArgCount(args, 1);
        int count = 0;
        for (Expr a : args) {
            count += COUNT.count(a, true);
        }
        return new ExprInteger(count);
    }
View Full Code Here

        assertMinArgCount(args, 1);
        int count = 0;
        for (Expr a : args) {
            count += count(a);
        }
        return new ExprInteger(count);
    }
View Full Code Here

TOP

Related Classes of org.boris.expr.ExprInteger

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.