Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Represents the if 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.
#condition: expression
ID of the expression in this if statement.
#thenPart: statement
ID of the “then” part of this if statement.
#elsePart: statement, null
ID of the “else” part of this if statement, or 'null' if this if statement has no “else” part.
void myIf(){ int i =0; if (i > 0)//corresponding code line to ifT i++; }
methodT(#enclMethod, ..., 'myIf', [], type(basic, void, 0), [], #parent). blockT(#parent, #enclMethod, #enclMethod, [..., #id]). ifT(#id, #parent, #enclMethod, #condition, #thenPart, 'null'). operationT(#condition, #id, #enclMethod, [..., ...], '>', 0). execT(#thenPart, #id, #enclMethod, ...).
ast_node_def('Java',ifT,[ ast_arg(id, mult(1,1,no ), id, [ifT]), % <-- convention!!! ast_arg(parent, mult(1,1,no ), id, [id]), % <-- convention!!! ast_arg(encl, mult(1,1,no ), id, [methodT, constructorT, classInitializerT]), ast_arg(cond, mult(1,1,no ), id, [expressionType]), ast_arg(then, mult(1,1,no ), id, [blockT,statementType]), ast_arg(else, mult(0,1,no), id, [nullType,blockT,statementType]) ]).