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:4.2:assertt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
 +
 +----
 +=== assertT(#​id,​ #parent, #​enclMethod,​ #condition, #msg)  ===
 +
 +
 +Represents the assert statement (Java 1.4).\\
 +=== Attributes ===
 +== ==
 + ​**#​id:​** id\\ 
 +the unique ID assigned to this fact.
 +
 +**#​parent:​** id\\ 
 +ID of the father node in the AST, typically a block.
 +
 +**#​enclMethod:​** [[methodt|methodT]],​ [[constructort|constructorT]],​ [[classinitializert|classInitializerT ]]\\
 +ID of the enclosing method declaration.
 +
 +**#​condition:​** [[plastexpression|expression]]\\ ​
 +boolean expression'​s ID.
 +
 +**#msg:** [[plastexpression|expression]],​ null\\ ​
 +ID of the expression that is to be given to assertionerror.
 +
 +=== Sample Java Source ===
 +==  ==
 +<Code lang-java>​
 +assertionDemo(){
 +   ​assert m() == 0 : "​Error:​ ...";//​corresponding code line to assertT
 +}
 +
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +
 +==  ==
 +<Code lang-prolog>​
 +assertT(#​id,​ #parent, #​enclMethod,​ #condition, #​msg). ​                                
 +blockT(#​parent,​ #​enclMethod,​ #​enclMethod,​ [#​id]). ​                       //Parent Node
 +methodT(#​enclMethod,​ ..., '​assertionDemo',​ [], type(basic, void, 0), [], #​parent).//​Enclosing Method
 +operationT(#​condition,​ #id, #​enclMethod,​ [..., ...], '​==',​ 0).           //​Condition
 +literalT(#​msg,​ #id, #​enclMethod,​ type(class, Type1, 0), '​Error:​ ...'​). ​  //​Message ​
 +
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +ast_node_def('​Java',​assertT,​[
 +     ​ast_arg(id, ​     mult(1,1,no ), id,  [assertT]), % <-- convention!!!
 +     ​ast_arg(parent, ​ mult(1,1,no ), id,  [id]), ​
 +     ​ast_arg(encl, ​   mult(1,1,no ), id,  [methodT, constructorT,​ classInitializerT]),​
 +     ​ast_arg(expr, ​   mult(0,​1,​no), ​ id,  [expressionType]),​
 +     ​ast_arg(msg, ​    ​mult(0,​1,​no), ​ id,  [expressionType,​nullType])
 +]).</​Code>​
 +
  
research/jtransformer/api/java/pefs/4.2/assertt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019