public class FilterFunction<NODE_TYPE> extends Object
expr ::= FILTER '(' WORD ',' expr ')'
Constructor and Description |
---|
FilterFunction() |
Modifier and Type | Method and Description |
---|---|
Set<T> |
eval(QueryEvaluator<ENV_NODE_TYPE> evaluator,
QueryEnvironment<ENV_NODE_TYPE> env,
com.google.common.collect.ImmutableList<QueryEnvironment.Argument<ENV_NODE_TYPE>> args)
Called when a user-defined function is to be evaluated.
|
com.google.common.collect.ImmutableList<QueryEnvironment.ArgumentType> |
getArgumentTypes()
The types of the arguments of the function.
|
protected QueryExpression<NODE_TYPE> |
getExpressionToEval(com.google.common.collect.ImmutableList<QueryEnvironment.Argument<NODE_TYPE>> args) |
int |
getMandatoryArguments()
The number of arguments that are required.
|
String |
getName()
Name of the function as it appears in the query language.
|
protected String |
getPattern(com.google.common.collect.ImmutableList<QueryEnvironment.Argument<NODE_TYPE>> args) |
protected String |
getStringToFilter(QueryEnvironment<NODE_TYPE> env,
com.google.common.collect.ImmutableList<QueryEnvironment.Argument<NODE_TYPE>> args,
QueryTarget target) |
public String getName()
QueryEnvironment.QueryFunction
public int getMandatoryArguments()
QueryEnvironment.QueryFunction
This should be greater than or equal to zero and at smaller than or equal to the length of
the list returned by QueryEnvironment.QueryFunction.getArgumentTypes()
.
public com.google.common.collect.ImmutableList<QueryEnvironment.ArgumentType> getArgumentTypes()
QueryEnvironment.QueryFunction
protected QueryExpression<NODE_TYPE> getExpressionToEval(com.google.common.collect.ImmutableList<QueryEnvironment.Argument<NODE_TYPE>> args)
protected String getPattern(com.google.common.collect.ImmutableList<QueryEnvironment.Argument<NODE_TYPE>> args)
protected String getStringToFilter(QueryEnvironment<NODE_TYPE> env, com.google.common.collect.ImmutableList<QueryEnvironment.Argument<NODE_TYPE>> args, QueryTarget target)
public Set<T> eval(QueryEvaluator<ENV_NODE_TYPE> evaluator, QueryEnvironment<ENV_NODE_TYPE> env, com.google.common.collect.ImmutableList<QueryEnvironment.Argument<ENV_NODE_TYPE>> args) throws QueryException
QueryEnvironment.QueryFunction
eval
in interface QueryEnvironment.QueryFunction<T extends QueryTarget,ENV_NODE_TYPE>
evaluator
- the evaluator for evaluating argument expressions.env
- the query environment this function is evaluated in.args
- the input arguments. These are type-checked against the specification returned by
QueryEnvironment.QueryFunction.getArgumentTypes()
and QueryEnvironment.QueryFunction.getMandatoryArguments()
Set
to
enable actual implementation to avoid making unnecessary copies, but resulting set is not
supposed to be mutated afterwards so implementation is ok to return ImmutableSet
.QueryException