Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Represents the switch statement.
#id: id
the unique ID assigned to this fact.
#parent: id
ID of the parent node.
#encl: methodT, constructorT, classInitializerT
ID of the enclosing method declaration.
#expr: expression
ID of the selection expression (the variable used to switch).
[#statement_1, …]: statement
list of the statements in the switch. Cases (caseT) are a special kind of statement here, much like labels. The default statement is a case statement with the label 'null'.
void mySwitch() { int month = 1; switch (month) {// corresponding code line to switchT case 1: //caseT System.out.println("January"); break; //breakT default: //caseT System.out.println("Invalid month."); break; //breakT } }
switchT(#id, #parent, #enclMethod, #expr, [#state_1, #state_2, #state_3, #state_4, #state_5, #state_6]). blockT(#parent, #enclMethod, #enclMethod, [..., #id]). methodT(#enclMethod, ..., 'mySwitch', [], type(basic, void, 0), [], #parent). identT(#expr, #id, #enclMethod, 'month', ...). caseT(#state_1, #id, #enclMethod, ...). execT(#state_2, #id, #enclMethod, ...). breakT(#state_3, #id, #enclMethod, 'null', #id). caseT(#state_4, #id, #enclMethod, 'null'). execT(#state_5, #id, #enclMethod, #parent1). breakT(#state_6, #id, #enclMethod, 'null', #id).
ast_node_type_spec(switchT,[ ast_arg(id, mult(1,1,no ), id, [switchT]), ast_arg(parent, mult(1,1,no ), id, [id]), ast_arg(encl, mult(1,1,no ), id, [methodT, constructorT, classInitializerT]), ast_arg(cond, mult(1,1,no ), id, [expressionType]), ast_arg(stmts, mult(0,*,ord), id, [statementType]) ]).