/**
* {@inheritDoc}
*/
@Override
public void checkParameterizedTerm(final Term term) throws SemanticWarning {
final FunctionEnum funcEnum = term.getFunctionEnum();
// Construct the signature
final StringBuilder bldr = new StringBuilder();
bldr.append(funcEnum.getDisplayValue());
bldr.append("(");
List<BELObject> functionArguments = term.getFunctionArguments();
if (hasItems(functionArguments)) {
for (int i = 0; i < functionArguments.size(); i++) {
final BELObject bo = functionArguments.get(i);
String arg = null;
if (bo instanceof Parameter) {
arg = processParameter((Parameter) bo);
} else if (bo instanceof Term) {
arg = processTerm((Term) bo);
if (arg == null) continue;
} else {
String type = bo.getClass().getName();
final String err = "unknown function argument " + type;
throw new UnsupportedOperationException(err);
}
if (i != 0) bldr.append(",");
bldr.append(arg);
}
}
bldr.append(")");
bldr.append(funcEnum.getReturnType().getDisplayValue());
Signature sig = null;
try {
sig = new Signature(bldr.toString());
} catch (InvalidArgument e) {
final String lf = term.toBELLongForm();
final String err = e.getMessage();
throw new SemanticWarning(lf, err);
}
final Function function = funcEnum.getFunction();
if (!function.validSignature(sig)) {
final Map<Signature, SemanticStatus> map = function.getStatus(sig);
final String lf = term.toBELLongForm();
final String err = format(SEMANTIC_TERM_FAILURE, lf);