try {
Set<NameParameterCountKey> scriptsSet = new HashSet<NameParameterCountKey>();
for (ExpressionScriptProvided script : scripts) {
validateScript(script);
NameParameterCountKey key = new NameParameterCountKey(script.getName(), script.getParameterNames().size());
if (scriptsSet.contains(key)) {
throw new ExprValidationException("Script name '" + script.getName() + "' has already been defined with the same number of parameters");
}
scriptsSet.add(key);
}
if (expressionDeclDesc != null) {
for (ExpressionDeclItem declItem : expressionDeclDesc.getExpressions()) {
if (scriptsSet.contains(new NameParameterCountKey(declItem.getName(), 0))) {
throw new ExprValidationException("Script name '" + declItem.getName() + "' overlaps with another expression of the same name");
}
}
}
}