use of org.apache.commons.jxpath.ri.compiler.CoreFunction in project collect by openforis.
the class ModelJXPathCompiledExpression method getFunctionNames.
public Set<String> getFunctionNames() {
Set<String> names = new HashSet<String>();
Deque<Expression> stack = new LinkedList<Expression>();
stack.push(getExpression());
while (!stack.isEmpty()) {
Expression expression = stack.pop();
if (expression instanceof Operation) {
if (expression instanceof CoreFunction || expression instanceof ModelExtensionFunction) {
String name = expression.toString().replaceAll("\\(.*\\)", "");
names.add(name);
}
Expression[] arguments = ((Operation) expression).getArguments();
if (arguments != null && arguments.length > 0) {
for (Expression arg : arguments) {
stack.push(arg);
}
}
}
}
return names;
}
Aggregations