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

Both sides previous revision Previous revision
Next revision
Previous revision
research:jtransformer:api:java:pefs:4.0:caset [2015/04/28 12:31]
127.0.0.1 external edit
research:jtransformer:api:java:pefs:4.0:caset [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
  
 +----
 +
 +=== caseT(#id, #parent, #encl, #​label) ​ ===
 +
 +Represents the case statement within the switch statement.
 +
 +===Attributes===
 +
 +**#​id:​**\\ ​
 +the unique ID assigned to this fact.
 +
 +**#​parent:​**\\ ​
 +ID of the switch statement being used for the node. (which incidentally is the parent within the AST).
 +
 +**#encl:** [[methodt|methodT]],​ [[constructorT|constructorT]],​ [[classInitializerT|classInitializerT]]\\ ​
 +ID of the enclosing element.
 +
 +**#label:** [[plastexpression|expression]],​ null\\ ​
 +ID of the reference to a label. For the default case (//​default://​) this is '​null'​.
 + 
 +
 +=== Sample Java Source ===
 +
 +==  ==
 +<Code lang-java>​
 +void mySwitch() {
 + int month = 1;
 + switch (month) {
 + case 1:                          // case 1 
 +    ​System.out.println("​January"​);​
 +    ​break;​
 + default: ​                        // case 2
 +    ​System.out.println("​Invalid month."​);​
 +    ​break;​
 + }
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +
 +==  ==
 +<Code lang-prolog>​
 +methodT(#​Method,​ #Class, '​mySwitch',​ [], type(basic, void, 0), [], #Block),
 +...
 +switchT(#​Switch,​ #Block, #Method, ., ...),
 +...
 +caseT(#​Case,​ #Switch, #Method, #​Expression), ​                          //​case 1
 +literalT(#​Expression,​ #Case, #Method, type(basic, int, 0), '​1'​),​
 +...
 +
 +caseT(#​CaseDefault,​ #Switch, #Method, '​null'​), ​                       // case 2
 +...
 +</​Code>​
 + 
 +=== AST Specification===
 +== ==
 +<​Code>​
 +ast_node_type_spec(caseT,​[
 +     ​ast_arg(id, ​     mult(1,1,no ), id,  [caseT]),
 +     ​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,​ nullType])
 +]).
 +</​Code>​
research/jtransformer/api/java/pefs/4.0/caset.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019