SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools



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, 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.

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_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])
]).
research/jtransformer/api/java/pefs/4.2/conditionalt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024