Packages, Compilation Units and Imports | Annotations | Declarations | Type Elements & Relations | Expressions | Statements | Body Level Attributes |
|---|
conditionalT (#id, #parent, #encl, #condition, #thenPart, #elsePart)
Represents the conditional expression:
(condition) ? then : else
Attributes
#id: id
the unique ID assigned to this fact.
#parent: id
ID of the parent node.
#encl: methodT, constructorT, classInitializerT, fieldT , classT, annotationMemberT, annotationT
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.
Sample Java Source
int myConditional(){ int a= 10; int b = 5; int max; max = (a > b) ? a : b;//corresponding code line to conditionalT return max; }
Its PEF Representation
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 Specification
ast_node_def('Java',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, annotationT]),
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])
]).


