Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Represents the for statement.
#id: id
the unique ID assigned to this fact.
#parent: id
ID of the parent node.
#encl: methodT, constructorT, classInitializerT
ID of the enclosing element.
[#init_1,…]: expression, localT
list of IDs of the initializer expressions in this for statement.
#condition: expression, null
ID of the expression in this for statement.
[#step_1,…]: expression
list of IDs of the update expressions in this for statement.
#body: statement
ID of the body of this for statement.
void myFor(){ int j = 0; for (int i = 0; i < 10;i ++){ // corresponding code line to forT j++; } }
methodT(#Method, _, 'myFor', [], type(basic, void, 0), [], #Block), blockT(#Block, #Method, #Method, [_, #For]), ... forT(#For, #Block, #Method, [#Local], #OperationT, [#OperationT2], #Block2), % for localT(#Local, #For, #Method, type(basic, int, 0), 'i', ..), %j = 0 ... operationT(#OperationT, #For, #Method, [..], '<', 0), % i<10 ... operationT(#OperationT2, #For, #Method, [..], '++', 1), %i++ ... blockT(#Block2, #For, #Method, [..]),
ast_node_def('Java',forT,[ ast_arg(id, mult(1,1,no ), id, [forT]), % <-- convention!!! ast_arg(parent, mult(1,1,no ), id, [id]), % <-- convention!!! ast_arg(encl, mult(1,1,no ), id, [methodT, constructorT, classInitializerT]), ast_arg(inits, mult(0,*,ord), id, [expressionType,localT]), ast_arg(cond, mult(0,1,no), id, [expressionType,nullType]), ast_arg(updaters,mult(0,*,ord), id, [expressionType]), ast_arg(body, mult(1,1,no ), id, [statementType]) ]).