SDA SE Wiki

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

User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

research:jtransformer:api:java:pefs:2.9:conditionalt [2018/05/09 01:59]
research:jtransformer:api:java:pefs:2.9:conditionalt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
 +
 +----
 +
 +=== 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|methodT]],​ [[constructorT|constructorT]],​ [[classInitializerT|classInitializerT]],​ [[fieldt|fieldT]] , [[classt|classT]],​ [[annotationMemberT|annotationMemberT]]\\ ​
 +ID of the fact that represents the enclosing element.
 +
 +**#​condition:​** [[plastexpression|expression]]\\ ​
 +ID of the expression in this conditional expression.
 +
 +**#​thenPart:​** [[plastexpression|expression]]\\ ​
 +ID of the "​then"​ part of this conditional expression.
 +
 +**#​elsePart:​** [[plastexpression|expression]]\\ ​
 +ID of the "​else"​ part of this conditional expression. ​
 +
 +=== Sample Java Source===
 +==  ==
 +<Code lang-java>​
 +int myConditional(){
 + int a= 10;
 + int b = 5;
 + int max;
 + max = (a > b) ?   a :  b;//​corresponding code line to conditionalT
 + return max;
 +}
 +
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +methodT(#​encl,​ ..., '​myConditional',​ [], type(basic, int, 0), [], ...).
 +...
 +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',​ ...).
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +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]),​
 +     ​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])
 +]).
 +</​Code>​
  
research/jtransformer/api/java/pefs/2.9/conditionalt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019