Package org.boris.expr

Examples of org.boris.expr.Expr


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

        Expr eV = evalArg(args[0]);
        if (eV instanceof ExprError)
            return eV;
        if (!isNumber(eV))
            return ExprError.VALUE;
        double value = ((ExprNumber) eV).doubleValue();

        Expr eF = evalArg(args[0]);
        if (eF instanceof ExprError)
            return eF;
        String s = asString(eF, false);

        String res = ValueFormatter.format(value, s);
View Full Code Here


public class ISBLANK extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);
        Expr e = evalArg(args[0]);
        return bool(e instanceof ExprMissing ||
                (e instanceof ExprString && "".equals(((ExprString) e).str)));
    }
View Full Code Here

public class ISNUMBER extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);
        Expr e = evalArg(args[0]);
        return bool(e instanceof ExprInteger || e instanceof ExprDouble);
    }
View Full Code Here

public class CRITBINOM extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 3);
        Expr et = evalArg(args[0]);
        if (!isNumber(et))
            return ExprError.VALUE;
        int trials = ((ExprNumber) et).intValue();
        if (trials < 0)
            return ExprError.NUM;
        Expr ep = evalArg(args[1]);
        if (!isNumber(ep))
            return ExprError.VALUE;
        double p = ((ExprNumber) ep).doubleValue();
        if (p < 0 || p > 1)
            return ExprError.NUM;
        Expr ea = evalArg(args[2]);
        if (!isNumber(ea))
            return ExprError.VALUE;
        double alpha = ((ExprNumber) ea).doubleValue();
        if (alpha < 0 || alpha > 1)
            return ExprError.NUM;
View Full Code Here

public class INT extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);
        Expr a = args[0];
        if (a instanceof ExprEvaluatable) {
            a = ((ExprEvaluatable) a).evaluate();
        }
        if (a instanceof ExprInteger) {
            return a;
View Full Code Here

public class CHIINV extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 2);
        Expr eP = evalArg(args[0]);
        if (!isNumber(eP))
            return ExprError.VALUE;
        double p = ((ExprNumber) eP).doubleValue();
        if (p < 0 || p > 1)
            return ExprError.NUM;
        Expr eDF = evalArg(args[1]);
        if (!isNumber(eDF))
            return ExprError.VALUE;
        int df = ((ExprNumber) eDF).intValue();
        if (df < 0 || df > 10e10)
            return ExprError.NUM;
View Full Code Here

public class DATE extends AbstractFunction
{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 3);
        Expr eY = evalArg(args[0]);
        if (!isNumber(eY))
            return ExprError.VALUE;
        double y = ((ExprNumber) eY).doubleValue();
        Expr eM = evalArg(args[1]);
        if (!isNumber(eM))
            return ExprError.VALUE;
        double m = ((ExprNumber) eM).doubleValue();
        Expr eD = evalArg(args[1]);
        if (!isNumber(eD))
            return ExprError.VALUE;
        double d = ((ExprNumber) eD).doubleValue();
        double r = ExcelDate.date(y, m, d);
        if (r < 0)
View Full Code Here

{
    public Expr evaluate(Expr[] args) throws 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);
        int cols = asInteger(args[2], true);
        int height = 1;
        int width = 1;
        if (args.length > 3) {
            Expr h = args[3];
            if (!(h instanceof ExprMissing)) {
                height = asInteger(h, true);
            }
        }
        if (height < 1) {
            return ExprError.VALUE;
        }
        if (args.length > 4) {
            Expr w = args[4];
            if (!(w instanceof ExprMissing)) {
                width = asInteger(w, true);
            }
        }
        if (width < 1) {
View Full Code Here

TOP

Related Classes of org.boris.expr.Expr

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.