// too many args in foo()
matchCount = -1;
break;
}
// do we have an eager wildcard in the middle ?
ASTParameter parameterNode = (ASTParameter) parameterNodes.get(iexp+1);
boolean isEager = parameterNode.getDeclaringClassPattern().isEagerWildCard();
if (isEager) {
// TODO - ignore for now, but not really supported - eager in the middle will match one
}
if (Boolean.TRUE.equals((Boolean) parameterNode.jjtAccept(this, parameterTypes[ictx]))) {
matchCount += 1;
ictx++;
} else {
// assume matched by starting ".." and rewind expression index
matchCount = 0;
ictx++;
iexp = -1;
}
}
if (matchCount == expressionParameterCount) {
return true;
} else {
return false;
}
} else if (isFirstArgEager) {
expressionParameterCount--;
if (contextParametersCount >= expressionParameterCount) {
// do a match from last to first, break when foo() nodes are exhausted
for (int i = 0; (i < contextParametersCount) && (expressionParameterCount - i >= 0); i++) {
ASTParameter parameterNode = (ASTParameter) parameterNodes.get(expressionParameterCount - i);
if (Boolean.TRUE.equals((Boolean) parameterNode.jjtAccept(
this,
parameterTypes[contextParametersCount -1 -i]))) {
;//go on with "next" param
} else {
return false;
}
}
return true;
} else {
//foo() as more param than context we try to match
return false;
}
} else if (isLastArgEager) {
expressionParameterCount--;
if (contextParametersCount >= expressionParameterCount) {
// do a match from first to last, break when foo() nodes are exhausted
for (int i = 0; (i < contextParametersCount) && (i < expressionParameterCount); i++) {
ASTParameter parameterNode = (ASTParameter) parameterNodes.get(i);
if (Boolean.TRUE.equals((Boolean) parameterNode.jjtAccept(this, parameterTypes[i]))) {
;//go on with next param
} else {
return false;
}
}
return true;
} else {
return false;
}
} else {
// no eager wildcard in foo()
// check that param length are equals
if (expressionParameterCount == contextParametersCount) {
for (int i = 0; i < parameterNodes.size(); i++) {
ASTParameter parameterNode = (ASTParameter) parameterNodes.get(i);
if (Boolean.TRUE.equals((Boolean) parameterNode.jjtAccept(this, parameterTypes[i]))) {
;//go on with next param
} else {
return false;
}
}