Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Represents a lambda expression. See the Java Language Specification. This PEF has two optional flags: omit_lambdaParameterParenthesesT and omit_lambdaParameterTypesT used for preserving syntactic suggar when regenerating source code after transformations.
#id: id
the unique ID assigned to this fact.
#parent: id
the ID of the fact that represents the parent of this fact in the prolog AST.
#encl: Method declaration type, fieldT
the ID of the fact that represents the enclosing element.
[#param_1,…]: paramT
list of this lambda expression's parameters
#body: expression, blockT
ID of the expression or block element for this lambda expression
JButton button = new JButton(); button.addActionListener((ActionEvent e) -> System.out.println("button pressed"));
localT(#Button, ..., 'button', ...). ... callT(#Parent, ..., [#Lambda], #RefToAddActionListener, [], ...). lambdaT(#Lambda, #Parent, #Enclosing, [#Parameter], #Body). paramT(#Parameter, #Lambda, #RefToActionEvent 'e'). // Paramter of the lambda expression callT(#Body, #Lambda, #Lambda, ...). // Sysout call (Body of the lambda expression)
ast_node_type_spec(lambdaT,[ ast_arg(id, mult(1,1,no ), id, [lambdaT]), ast_arg(parent, mult(1,1,no ), id, [id]), ast_arg(encl, mult(1,1,no ), id, [method_declaration_type, fieldT]), ast_arg(params, mult(0,*,ord), id, [paramT]), ast_arg(body, mult(1,1,no), id, [blockT, expressionType]) ]).