1 | package de.uka.ipd.sdq.pcm.stochasticexpressions; |
2 | |
3 | import org.eclipse.emf.ecore.EClass; |
4 | import org.eclipse.emf.ecore.EObject; |
5 | |
6 | import de.uka.ipd.sdq.pcm.parameter.CharacterisedVariable; |
7 | import de.uka.ipd.sdq.pcm.parameter.ParameterPackage; |
8 | import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisation; |
9 | import de.uka.ipd.sdq.pcm.parameter.VariableUsage; |
10 | import de.uka.ipd.sdq.stoex.analyser.visitors.StoExPrettyPrintVisitor; |
11 | |
12 | public class PCMStoExPrettyPrintVisitor extends StoExPrettyPrintVisitor { |
13 | |
14 | protected String doSwitch(EClass theEClass, EObject theEObject) { |
15 | if (theEClass == ParameterPackage.eINSTANCE.getCharacterisedVariable()) { |
16 | return caseCharacterisedVariable((CharacterisedVariable) theEObject); |
17 | } else if (theEClass == ParameterPackage.eINSTANCE.getVariableUsage()){ |
18 | return caseVariableUsage((VariableUsage) theEObject); |
19 | } else if (theEClass == ParameterPackage.eINSTANCE.getVariableCharacterisation()){ |
20 | return caseVariableCharacterisation((VariableCharacterisation) theEObject); |
21 | } else { |
22 | return super.doSwitch(theEClass, theEObject); |
23 | } |
24 | } |
25 | |
26 | public String caseCharacterisedVariable(CharacterisedVariable object) { |
27 | String result = (String)doSwitch(object.getId_Variable()); |
28 | result += "." + object.getCharacterisationType().getLiteral(); |
29 | return result; |
30 | } |
31 | |
32 | public String caseVariableUsage(VariableUsage object) { |
33 | String result = ""; |
34 | if (object.getNamedReference__VariableUsage() != null) |
35 | result += doSwitch(object.getNamedReference__VariableUsage()); |
36 | else |
37 | result += "<not set yet>"; |
38 | if (object.getVariableCharacterisation_VariableUsage().size() > 0) |
39 | result += "." + doSwitch((VariableCharacterisation)object.getVariableCharacterisation_VariableUsage().get(0)); |
40 | else |
41 | result += ".<missing characterisation> = <missing expression>"; |
42 | return result; |
43 | } |
44 | |
45 | public String caseVariableCharacterisation(VariableCharacterisation object) { |
46 | String result = ""; |
47 | result += object.getType().getLiteral(); |
48 | //result += " = " + object.getSpecification_VariableCharacterisation().getSpecification(); |
49 | return result; |
50 | } |
51 | } |