diff options
author | ArenBabikian <aren.babikian@mail.mcgill.ca> | 2019-05-20 18:47:20 -0400 |
---|---|---|
committer | ArenBabikian <aren.babikian@mail.mcgill.ca> | 2019-05-20 18:47:20 -0400 |
commit | d76c1c496b0774e28b699dd5ff4f446d580fd986 (patch) | |
tree | 1846760e7cdccfb06ae0f0fe27419491e5ae33bd /Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util | |
parent | REALMET: first impl of n'hood visualis. minor bug with adding outgng 0s. (diff) | |
download | VIATRA-Generator-d76c1c496b0774e28b699dd5ff4f446d580fd986.tar.gz VIATRA-Generator-d76c1c496b0774e28b699dd5ff4f446d580fd986.tar.zst VIATRA-Generator-d76c1c496b0774e28b699dd5ff4f446d580fd986.zip |
REALMET: implement incoming edges in visualisation. multips need fix
Diffstat (limited to 'Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util')
2 files changed, 308 insertions, 0 deletions
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartAdapterFactory.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartAdapterFactory.java new file mode 100644 index 00000000..908a7f5f --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartAdapterFactory.java | |||
@@ -0,0 +1,156 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package simpleStatechart.util; | ||
4 | |||
5 | import org.eclipse.emf.common.notify.Adapter; | ||
6 | import org.eclipse.emf.common.notify.Notifier; | ||
7 | |||
8 | import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; | ||
9 | |||
10 | import org.eclipse.emf.ecore.EObject; | ||
11 | |||
12 | import simpleStatechart.*; | ||
13 | |||
14 | /** | ||
15 | * <!-- begin-user-doc --> | ||
16 | * The <b>Adapter Factory</b> for the model. | ||
17 | * It provides an adapter <code>createXXX</code> method for each class of the model. | ||
18 | * <!-- end-user-doc --> | ||
19 | * @see simpleStatechart.SimpleStatechartPackage | ||
20 | * @generated | ||
21 | */ | ||
22 | public class SimpleStatechartAdapterFactory extends AdapterFactoryImpl { | ||
23 | /** | ||
24 | * The cached model package. | ||
25 | * <!-- begin-user-doc --> | ||
26 | * <!-- end-user-doc --> | ||
27 | * @generated | ||
28 | */ | ||
29 | protected static SimpleStatechartPackage modelPackage; | ||
30 | |||
31 | /** | ||
32 | * Creates an instance of the adapter factory. | ||
33 | * <!-- begin-user-doc --> | ||
34 | * <!-- end-user-doc --> | ||
35 | * @generated | ||
36 | */ | ||
37 | public SimpleStatechartAdapterFactory() { | ||
38 | if (modelPackage == null) { | ||
39 | modelPackage = SimpleStatechartPackage.eINSTANCE; | ||
40 | } | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Returns whether this factory is applicable for the type of the object. | ||
45 | * <!-- begin-user-doc --> | ||
46 | * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. | ||
47 | * <!-- end-user-doc --> | ||
48 | * @return whether this factory is applicable for the type of the object. | ||
49 | * @generated | ||
50 | */ | ||
51 | @Override | ||
52 | public boolean isFactoryForType(Object object) { | ||
53 | if (object == modelPackage) { | ||
54 | return true; | ||
55 | } | ||
56 | if (object instanceof EObject) { | ||
57 | return ((EObject)object).eClass().getEPackage() == modelPackage; | ||
58 | } | ||
59 | return false; | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * The switch that delegates to the <code>createXXX</code> methods. | ||
64 | * <!-- begin-user-doc --> | ||
65 | * <!-- end-user-doc --> | ||
66 | * @generated | ||
67 | */ | ||
68 | protected SimpleStatechartSwitch<Adapter> modelSwitch = | ||
69 | new SimpleStatechartSwitch<Adapter>() { | ||
70 | @Override | ||
71 | public Adapter caseState(State object) { | ||
72 | return createStateAdapter(); | ||
73 | } | ||
74 | @Override | ||
75 | public Adapter caseEntry(Entry object) { | ||
76 | return createEntryAdapter(); | ||
77 | } | ||
78 | @Override | ||
79 | public Adapter caseStatechart(Statechart object) { | ||
80 | return createStatechartAdapter(); | ||
81 | } | ||
82 | @Override | ||
83 | public Adapter defaultCase(EObject object) { | ||
84 | return createEObjectAdapter(); | ||
85 | } | ||
86 | }; | ||
87 | |||
88 | /** | ||
89 | * Creates an adapter for the <code>target</code>. | ||
90 | * <!-- begin-user-doc --> | ||
91 | * <!-- end-user-doc --> | ||
92 | * @param target the object to adapt. | ||
93 | * @return the adapter for the <code>target</code>. | ||
94 | * @generated | ||
95 | */ | ||
96 | @Override | ||
97 | public Adapter createAdapter(Notifier target) { | ||
98 | return modelSwitch.doSwitch((EObject)target); | ||
99 | } | ||
100 | |||
101 | |||
102 | /** | ||
103 | * Creates a new adapter for an object of class '{@link simpleStatechart.State <em>State</em>}'. | ||
104 | * <!-- begin-user-doc --> | ||
105 | * This default implementation returns null so that we can easily ignore cases; | ||
106 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
107 | * <!-- end-user-doc --> | ||
108 | * @return the new adapter. | ||
109 | * @see simpleStatechart.State | ||
110 | * @generated | ||
111 | */ | ||
112 | public Adapter createStateAdapter() { | ||
113 | return null; | ||
114 | } | ||
115 | |||
116 | /** | ||
117 | * Creates a new adapter for an object of class '{@link simpleStatechart.Entry <em>Entry</em>}'. | ||
118 | * <!-- begin-user-doc --> | ||
119 | * This default implementation returns null so that we can easily ignore cases; | ||
120 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
121 | * <!-- end-user-doc --> | ||
122 | * @return the new adapter. | ||
123 | * @see simpleStatechart.Entry | ||
124 | * @generated | ||
125 | */ | ||
126 | public Adapter createEntryAdapter() { | ||
127 | return null; | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * Creates a new adapter for an object of class '{@link simpleStatechart.Statechart <em>Statechart</em>}'. | ||
132 | * <!-- begin-user-doc --> | ||
133 | * This default implementation returns null so that we can easily ignore cases; | ||
134 | * it's useful to ignore a case when inheritance will catch all the cases anyway. | ||
135 | * <!-- end-user-doc --> | ||
136 | * @return the new adapter. | ||
137 | * @see simpleStatechart.Statechart | ||
138 | * @generated | ||
139 | */ | ||
140 | public Adapter createStatechartAdapter() { | ||
141 | return null; | ||
142 | } | ||
143 | |||
144 | /** | ||
145 | * Creates a new adapter for the default case. | ||
146 | * <!-- begin-user-doc --> | ||
147 | * This default implementation returns null. | ||
148 | * <!-- end-user-doc --> | ||
149 | * @return the new adapter. | ||
150 | * @generated | ||
151 | */ | ||
152 | public Adapter createEObjectAdapter() { | ||
153 | return null; | ||
154 | } | ||
155 | |||
156 | } //SimpleStatechartAdapterFactory | ||
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartSwitch.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartSwitch.java new file mode 100644 index 00000000..30c60e74 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/util/SimpleStatechartSwitch.java | |||
@@ -0,0 +1,152 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package simpleStatechart.util; | ||
4 | |||
5 | import org.eclipse.emf.ecore.EObject; | ||
6 | import org.eclipse.emf.ecore.EPackage; | ||
7 | |||
8 | import org.eclipse.emf.ecore.util.Switch; | ||
9 | |||
10 | import simpleStatechart.*; | ||
11 | |||
12 | /** | ||
13 | * <!-- begin-user-doc --> | ||
14 | * The <b>Switch</b> for the model's inheritance hierarchy. | ||
15 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} | ||
16 | * to invoke the <code>caseXXX</code> method for each class of the model, | ||
17 | * starting with the actual class of the object | ||
18 | * and proceeding up the inheritance hierarchy | ||
19 | * until a non-null result is returned, | ||
20 | * which is the result of the switch. | ||
21 | * <!-- end-user-doc --> | ||
22 | * @see simpleStatechart.SimpleStatechartPackage | ||
23 | * @generated | ||
24 | */ | ||
25 | public class SimpleStatechartSwitch<T> extends Switch<T> { | ||
26 | /** | ||
27 | * The cached model package | ||
28 | * <!-- begin-user-doc --> | ||
29 | * <!-- end-user-doc --> | ||
30 | * @generated | ||
31 | */ | ||
32 | protected static SimpleStatechartPackage modelPackage; | ||
33 | |||
34 | /** | ||
35 | * Creates an instance of the switch. | ||
36 | * <!-- begin-user-doc --> | ||
37 | * <!-- end-user-doc --> | ||
38 | * @generated | ||
39 | */ | ||
40 | public SimpleStatechartSwitch() { | ||
41 | if (modelPackage == null) { | ||
42 | modelPackage = SimpleStatechartPackage.eINSTANCE; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * Checks whether this is a switch for the given package. | ||
48 | * <!-- begin-user-doc --> | ||
49 | * <!-- end-user-doc --> | ||
50 | * @param ePackage the package in question. | ||
51 | * @return whether this is a switch for the given package. | ||
52 | * @generated | ||
53 | */ | ||
54 | @Override | ||
55 | protected boolean isSwitchFor(EPackage ePackage) { | ||
56 | return ePackage == modelPackage; | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. | ||
61 | * <!-- begin-user-doc --> | ||
62 | * <!-- end-user-doc --> | ||
63 | * @return the first non-null result returned by a <code>caseXXX</code> call. | ||
64 | * @generated | ||
65 | */ | ||
66 | @Override | ||
67 | protected T doSwitch(int classifierID, EObject theEObject) { | ||
68 | switch (classifierID) { | ||
69 | case SimpleStatechartPackage.STATE: { | ||
70 | State state = (State)theEObject; | ||
71 | T result = caseState(state); | ||
72 | if (result == null) result = defaultCase(theEObject); | ||
73 | return result; | ||
74 | } | ||
75 | case SimpleStatechartPackage.ENTRY: { | ||
76 | Entry entry = (Entry)theEObject; | ||
77 | T result = caseEntry(entry); | ||
78 | if (result == null) result = defaultCase(theEObject); | ||
79 | return result; | ||
80 | } | ||
81 | case SimpleStatechartPackage.STATECHART: { | ||
82 | Statechart statechart = (Statechart)theEObject; | ||
83 | T result = caseStatechart(statechart); | ||
84 | if (result == null) result = defaultCase(theEObject); | ||
85 | return result; | ||
86 | } | ||
87 | default: return defaultCase(theEObject); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | /** | ||
92 | * Returns the result of interpreting the object as an instance of '<em>State</em>'. | ||
93 | * <!-- begin-user-doc --> | ||
94 | * This implementation returns null; | ||
95 | * returning a non-null result will terminate the switch. | ||
96 | * <!-- end-user-doc --> | ||
97 | * @param object the target of the switch. | ||
98 | * @return the result of interpreting the object as an instance of '<em>State</em>'. | ||
99 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
100 | * @generated | ||
101 | */ | ||
102 | public T caseState(State object) { | ||
103 | return null; | ||
104 | } | ||
105 | |||
106 | /** | ||
107 | * Returns the result of interpreting the object as an instance of '<em>Entry</em>'. | ||
108 | * <!-- begin-user-doc --> | ||
109 | * This implementation returns null; | ||
110 | * returning a non-null result will terminate the switch. | ||
111 | * <!-- end-user-doc --> | ||
112 | * @param object the target of the switch. | ||
113 | * @return the result of interpreting the object as an instance of '<em>Entry</em>'. | ||
114 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
115 | * @generated | ||
116 | */ | ||
117 | public T caseEntry(Entry object) { | ||
118 | return null; | ||
119 | } | ||
120 | |||
121 | /** | ||
122 | * Returns the result of interpreting the object as an instance of '<em>Statechart</em>'. | ||
123 | * <!-- begin-user-doc --> | ||
124 | * This implementation returns null; | ||
125 | * returning a non-null result will terminate the switch. | ||
126 | * <!-- end-user-doc --> | ||
127 | * @param object the target of the switch. | ||
128 | * @return the result of interpreting the object as an instance of '<em>Statechart</em>'. | ||
129 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) | ||
130 | * @generated | ||
131 | */ | ||
132 | public T caseStatechart(Statechart object) { | ||
133 | return null; | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. | ||
138 | * <!-- begin-user-doc --> | ||
139 | * This implementation returns null; | ||
140 | * returning a non-null result will terminate the switch, but this is the last case anyway. | ||
141 | * <!-- end-user-doc --> | ||
142 | * @param object the target of the switch. | ||
143 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. | ||
144 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) | ||
145 | * @generated | ||
146 | */ | ||
147 | @Override | ||
148 | public T defaultCase(EObject object) { | ||
149 | return null; | ||
150 | } | ||
151 | |||
152 | } //SimpleStatechartSwitch | ||