@Override public Object getValue(EvaluationContext ctx) throws ELException {
// Correct evaluation requires knowledge of the whole set of nested // expressions, not just the current expression
LambdaExpressionNestedState state = ctx.getLambdaExpressionNestedState(); if (state == null) { // This must be an outer lambda expression. Create and populate the // state.
state = new LambdaExpressionNestedState();
populateNestedState(state);
ctx.setLambdaExpressionNestedState(state);
}
// Check that there are not more sets of parameters than there are // nested expressions. int methodParameterSetCount = jjtGetNumChildren() - 2; if (methodParameterSetCount > state.getNestingCount()) { thrownew ELException(MessageFactory.get( "error.lambda.tooManyMethodParameterSets"));
}
// First child is always parameters even if there aren't any
AstLambdaParameters formalParametersNode =
(AstLambdaParameters) children[0];
Node[] formalParamNodes = formalParametersNode.children;
// Second child is a value expression
ValueExpressionImpl ve = new ValueExpressionImpl("", children[1],
ctx.getFunctionMapper(), ctx.getVariableMapper(), null);
// Build a LambdaExpression
List<String> formalParameters = new ArrayList<>(); if (formalParamNodes != null) { for (Node formalParamNode : formalParamNodes) {
formalParameters.add(formalParamNode.getImage());
}
}
LambdaExpression le = new LambdaExpression(formalParameters, ve);
le.setELContext(ctx);
if (jjtGetNumChildren() == 2) { // No method parameters // Can only invoke the expression if none of the lambda expressions // in the nesting declare parameters if (state.getHasFormalParameters()) { return le;
} else { return le.invoke(ctx, (Object[]) null);
}
}
// Always have to invoke the outer-most expression int methodParameterIndex = 2;
Object result = le.invoke(((AstMethodParameters)
children[methodParameterIndex]).getParameters(ctx));
methodParameterIndex++;
while (result instanceof LambdaExpression &&
methodParameterIndex < jjtGetNumChildren()) {
result = ((LambdaExpression) result).invoke(((AstMethodParameters)
children[methodParameterIndex]).getParameters(ctx));
methodParameterIndex++;
}
return result;
}
privatevoid populateNestedState(LambdaExpressionNestedState lambdaExpressionNestedState) { // Increment the nesting count for the current expression
lambdaExpressionNestedState.incrementNestingCount();
if (jjtGetNumChildren() > 1) {
Node firstChild = jjtGetChild(0); if (firstChild instanceof AstLambdaParameters) { if (firstChild.jjtGetNumChildren() > 0) {
lambdaExpressionNestedState.setHasFormalParameters();
}
} else { // Can't be a lambda expression return;
}
Node secondChild = jjtGetChild(1); if (secondChild instanceof AstLambdaExpression) {
((AstLambdaExpression) secondChild).populateNestedState(lambdaExpressionNestedState);
}
}
}
@Override public String toString() { // Purely for debug purposes. May not be complete or correct. Certainly // is not efficient. Be sure not to call this from 'real' code.
StringBuilder result = new StringBuilder(); for (Node n : children) {
result.append(n.toString());
} return result.toString();
}
} /* JavaCC - OriginalChecksum=071159eff10c8e15ec612c765ae4480a (do not edit this line) */
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-10-03)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.