this.argList = new ArrayList<Var>(argList);
//Verify that all mentioned variables are in the arguments list
Set<Var> mentioned = this.expr.getVarsMentioned();
for (Var v : mentioned) {
if (!argList.contains(v)) throw new ExprBuildException("Cannot use the variable " + v.toString() + " in the expression since it is not included in the argList argument. All variables must be arguments to the function");
}
//If used variables is greater than argument variables this is an error
if (mentioned.size() > this.argList.size()) throw new ExprBuildException("Mismatch between variables used in expression and number of variables in argument list, expected " + this.argList.size() + " but found " + mentioned.size());
//May have more arguments than used, however this only gives warning(s)
if (mentioned.size() < this.argList.size()) {
for (Var v : this.argList) {
if (!mentioned.contains(v) && warnOnUnusedVariable) LOG.warn("Function <" + uri + "> has argument " + v + " which is never used in the expression");
}