Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Represents the conditional expression:
(condition) ? then : else
#id: id
the unique ID assigned to this fact.
#parent: id
ID of the parent node.
#encl: methodT, constructorT, classInitializerT, fieldT , classT, annotationMemberT, packageT
ID of the fact that represents the enclosing element.
#condition: expression
ID of the expression in this conditional expression.
#thenPart: expression
ID of the “then” part of this conditional expression.
#elsePart: expression
ID of the “else” part of this conditional expression.
int myConditional(){ int a= 10; int b = 5; int max; max = (a > b) ? a : b;//corresponding code line to conditionalT return max; }
methodT(#encl, ..., 'myConditional', [], #returntype, [], ...). ... assignT(#parent, ..., #encl, ..., #id). conditionalT(#id, #parent, #encl, #condition, #thenPart, #elsePart). % precedenceT(#condition, #id, #encl, ...). identT(#thenPart, #id, #encl, 'a', ...). identT(#elsePart, #id, #encl, 'b', ...).
ast_node_type_spec(conditionalT,[ ast_arg(id, mult(1,1,no ), id, [conditionalT]), ast_arg(parent, mult(1,1,no ), id, [id]), ast_arg(encl, mult(1,1,no ), id, [methodT, constructorT, classInitializerT, fieldT, classT, annotationMemberT, packageT]), ast_arg(cond, mult(1,1,no ), id, [expressionType]), ast_arg(thenexpr,mult(1,1,no ), id, [expressionType]), ast_arg(elseexpr,mult(1,1,no ), id, [expressionType]) ]).