Package com.google.refine.expr

Examples of com.google.refine.expr.EvalError


                String s = (o instanceof String) ? (String) o : o.toString();
                return ngram_fingerprint.key(s,ngram_size);
            }
            return null;
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects at least a string");
    }
View Full Code Here


            if (o != null) {
                String s = (o instanceof String) ? (String) o : o.toString();
                return StringUtils.splitByCharacterType(s);
            }
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 strings");
    }
View Full Code Here

                    Pattern pattern = (Pattern) split;
                    return pattern.split(str);
                }
            }
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 strings, or 1 string and 1 regex, followed by an optional boolean");
    }
View Full Code Here

                return ngrams;
            }
           
            return null;
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a string and a number");
    }
View Full Code Here

                    decoder = (String) args[2];
                }
                return reinterpret(str, decoder, encoder);
            }
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 or 3 arguments");
    }
View Full Code Here

            bytes = str.getBytes();
        } else {
            try {
                bytes = str.getBytes(decoder);
            } catch (UnsupportedEncodingException e) {
                return new EvalError(ControlFunctionRegistry.getFunctionName(this) + ": source encoding '" + decoder + "' is not available or recognized.");
            }
        }
        try {
            if (encoder == null || encoder.isEmpty()) {
                result = new String(bytes); // system default encoding
            } else {
                result = new String(bytes, encoder);
            }
        } catch (UnsupportedEncodingException e) {
            return new EvalError(ControlFunctionRegistry.getFunctionName(this) + ": encoding '" + encoder + "' is not available or recognized.");
        }
                       
        return result;
    }
View Full Code Here

    @Override
    public Object call(Properties bindings, Object[] args) {
        if (args.length == 1) {
            return !objectToBoolean(args[0]);
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a boolean");
    }
View Full Code Here

                }
            }
           
            return null;
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a string or a regexp");
    }
View Full Code Here

            Object s2 = args[1];
            if (s1 != null && s2 != null && s1 instanceof String && s2 instanceof String) {
                return ((String) s1).startsWith((String) s2);
            }
        }
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects 2 strings");
    }
View Full Code Here

            String s = o instanceof String ? (String) o : o.toString();
            o = args[1];
            String delims = o instanceof String ? (String) o: o.toString();
            return WordUtils.capitalizeFully(s,delims.toCharArray());
        } else {
            return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a one or two strings");
        }
    }
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.