Package com.google.refine.expr

Examples of com.google.refine.expr.EvalError


    @Override
    public Object call(Properties bindings, Object[] args) {
        if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
            return (long) Math.ceil(((Number) args[0]).doubleValue());
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
    }
View Full Code Here


                    return v.getClass().getName();
                }
            }
            return "undefined";
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects one argument");
    }
View Full Code Here

    @Override
    public Object call(Properties bindings, Object[] args) {
        if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
            return Math.acos(((Number) args[0]).doubleValue());
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
    }
View Full Code Here

                    String s = (v instanceof String ? (String) v : v.toString());
                    return s.length();
                }
            }
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects an array or a string");
    }
View Full Code Here

    @Override
    public Object call(Properties bindings, Object[] args) {
        if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
            return Math.abs(((Number) args[0]).doubleValue());
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
    }
View Full Code Here

    @Override
    public Object call(Properties bindings, Object[] args) {
        if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
            return Even.roundUpToEven(((Number) args[0]).doubleValue());
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
    }
View Full Code Here

    @Override
    public Object call(Properties bindings, Object[] args) {
        if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
            return (long) Math.floor(((Number) args[0]).doubleValue());
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
    }
View Full Code Here

                        );
               
                return join.getRows(((WrappedCell) wrappedCell).cell.value);
            }
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a cell, a project name to join with, and a column name in that project");
    }
View Full Code Here

    @Override
    public Object call(Properties bindings, Object[] args) {
        if (args.length == 1 && args[0] != null && args[0] instanceof Number) {
            return FactN.factorial(((Number) args[0]).intValue(), 1);
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a number");
    }
View Full Code Here

            String columnName = (String) args[2];

            Project project = (Project) bindings.get("project");
            Column column = project.columnModel.getColumnByName(columnName);
            if (column == null) {
                return new EvalError("No such column named " + columnName);
            }

            String key = "nominal-bin:" + facetExpression;
            ExpressionNominalValueGrouper grouper = (ExpressionNominalValueGrouper) column.getPrecompute(key);
            if (grouper == null) {
                try {
                    Evaluable eval = MetaParser.parse(facetExpression);
                    Engine engine = new Engine(project);

                    grouper = new ExpressionNominalValueGrouper(eval, columnName, column.getCellIndex());
                    engine.getAllRows().accept(project, grouper);

                    column.setPrecompute(key, grouper);
                } catch (ParsingException e) {
                    return new EvalError("Error parsing facet expression " + facetExpression);
                }
            }

            return grouper.getChoiceValueCountMultiple(choiceValue);
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) +
            " expects a choice value, an expression as a string, and a column name");
    }
View Full Code Here

TOP

Related Classes of com.google.refine.expr.EvalError

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.