diff options
Diffstat (limited to 'Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java')
-rw-r--r-- | Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java | 221 |
1 files changed, 221 insertions, 0 deletions
diff --git a/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java new file mode 100644 index 00000000..cef2ee61 --- /dev/null +++ b/Metrics/ca.mcgill.ecse.dslreasoner.realistic.metrics/src/simpleStatechart/impl/StatechartImpl.java | |||
@@ -0,0 +1,221 @@ | |||
1 | /** | ||
2 | */ | ||
3 | package simpleStatechart.impl; | ||
4 | |||
5 | import java.util.Collection; | ||
6 | |||
7 | import org.eclipse.emf.common.notify.Notification; | ||
8 | import org.eclipse.emf.common.notify.NotificationChain; | ||
9 | |||
10 | import org.eclipse.emf.common.util.EList; | ||
11 | |||
12 | import org.eclipse.emf.ecore.EClass; | ||
13 | import org.eclipse.emf.ecore.InternalEObject; | ||
14 | |||
15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; | ||
16 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; | ||
17 | |||
18 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; | ||
19 | import org.eclipse.emf.ecore.util.InternalEList; | ||
20 | |||
21 | import simpleStatechart.Entry; | ||
22 | import simpleStatechart.SimpleStatechartPackage; | ||
23 | import simpleStatechart.State; | ||
24 | import simpleStatechart.Statechart; | ||
25 | |||
26 | /** | ||
27 | * <!-- begin-user-doc --> | ||
28 | * An implementation of the model object '<em><b>Statechart</b></em>'. | ||
29 | * <!-- end-user-doc --> | ||
30 | * <p> | ||
31 | * The following features are implemented: | ||
32 | * </p> | ||
33 | * <ul> | ||
34 | * <li>{@link simpleStatechart.impl.StatechartImpl#getState <em>State</em>}</li> | ||
35 | * <li>{@link simpleStatechart.impl.StatechartImpl#getEntry <em>Entry</em>}</li> | ||
36 | * </ul> | ||
37 | * | ||
38 | * @generated | ||
39 | */ | ||
40 | public class StatechartImpl extends MinimalEObjectImpl.Container implements Statechart { | ||
41 | /** | ||
42 | * The cached value of the '{@link #getState() <em>State</em>}' containment reference list. | ||
43 | * <!-- begin-user-doc --> | ||
44 | * <!-- end-user-doc --> | ||
45 | * @see #getState() | ||
46 | * @generated | ||
47 | * @ordered | ||
48 | */ | ||
49 | protected EList<State> state; | ||
50 | |||
51 | /** | ||
52 | * The cached value of the '{@link #getEntry() <em>Entry</em>}' containment reference. | ||
53 | * <!-- begin-user-doc --> | ||
54 | * <!-- end-user-doc --> | ||
55 | * @see #getEntry() | ||
56 | * @generated | ||
57 | * @ordered | ||
58 | */ | ||
59 | protected Entry entry; | ||
60 | |||
61 | /** | ||
62 | * <!-- begin-user-doc --> | ||
63 | * <!-- end-user-doc --> | ||
64 | * @generated | ||
65 | */ | ||
66 | protected StatechartImpl() { | ||
67 | super(); | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * <!-- begin-user-doc --> | ||
72 | * <!-- end-user-doc --> | ||
73 | * @generated | ||
74 | */ | ||
75 | @Override | ||
76 | protected EClass eStaticClass() { | ||
77 | return SimpleStatechartPackage.Literals.STATECHART; | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * <!-- begin-user-doc --> | ||
82 | * <!-- end-user-doc --> | ||
83 | * @generated | ||
84 | */ | ||
85 | public EList<State> getState() { | ||
86 | if (state == null) { | ||
87 | state = new EObjectContainmentEList<State>(State.class, this, SimpleStatechartPackage.STATECHART__STATE); | ||
88 | } | ||
89 | return state; | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * <!-- begin-user-doc --> | ||
94 | * <!-- end-user-doc --> | ||
95 | * @generated | ||
96 | */ | ||
97 | public Entry getEntry() { | ||
98 | return entry; | ||
99 | } | ||
100 | |||
101 | /** | ||
102 | * <!-- begin-user-doc --> | ||
103 | * <!-- end-user-doc --> | ||
104 | * @generated | ||
105 | */ | ||
106 | public NotificationChain basicSetEntry(Entry newEntry, NotificationChain msgs) { | ||
107 | Entry oldEntry = entry; | ||
108 | entry = newEntry; | ||
109 | if (eNotificationRequired()) { | ||
110 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleStatechartPackage.STATECHART__ENTRY, oldEntry, newEntry); | ||
111 | if (msgs == null) msgs = notification; else msgs.add(notification); | ||
112 | } | ||
113 | return msgs; | ||
114 | } | ||
115 | |||
116 | /** | ||
117 | * <!-- begin-user-doc --> | ||
118 | * <!-- end-user-doc --> | ||
119 | * @generated | ||
120 | */ | ||
121 | public void setEntry(Entry newEntry) { | ||
122 | if (newEntry != entry) { | ||
123 | NotificationChain msgs = null; | ||
124 | if (entry != null) | ||
125 | msgs = ((InternalEObject)entry).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleStatechartPackage.STATECHART__ENTRY, null, msgs); | ||
126 | if (newEntry != null) | ||
127 | msgs = ((InternalEObject)newEntry).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleStatechartPackage.STATECHART__ENTRY, null, msgs); | ||
128 | msgs = basicSetEntry(newEntry, msgs); | ||
129 | if (msgs != null) msgs.dispatch(); | ||
130 | } | ||
131 | else if (eNotificationRequired()) | ||
132 | eNotify(new ENotificationImpl(this, Notification.SET, SimpleStatechartPackage.STATECHART__ENTRY, newEntry, newEntry)); | ||
133 | } | ||
134 | |||
135 | /** | ||
136 | * <!-- begin-user-doc --> | ||
137 | * <!-- end-user-doc --> | ||
138 | * @generated | ||
139 | */ | ||
140 | @Override | ||
141 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | ||
142 | switch (featureID) { | ||
143 | case SimpleStatechartPackage.STATECHART__STATE: | ||
144 | return ((InternalEList<?>)getState()).basicRemove(otherEnd, msgs); | ||
145 | case SimpleStatechartPackage.STATECHART__ENTRY: | ||
146 | return basicSetEntry(null, msgs); | ||
147 | } | ||
148 | return super.eInverseRemove(otherEnd, featureID, msgs); | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * <!-- begin-user-doc --> | ||
153 | * <!-- end-user-doc --> | ||
154 | * @generated | ||
155 | */ | ||
156 | @Override | ||
157 | public Object eGet(int featureID, boolean resolve, boolean coreType) { | ||
158 | switch (featureID) { | ||
159 | case SimpleStatechartPackage.STATECHART__STATE: | ||
160 | return getState(); | ||
161 | case SimpleStatechartPackage.STATECHART__ENTRY: | ||
162 | return getEntry(); | ||
163 | } | ||
164 | return super.eGet(featureID, resolve, coreType); | ||
165 | } | ||
166 | |||
167 | /** | ||
168 | * <!-- begin-user-doc --> | ||
169 | * <!-- end-user-doc --> | ||
170 | * @generated | ||
171 | */ | ||
172 | @SuppressWarnings("unchecked") | ||
173 | @Override | ||
174 | public void eSet(int featureID, Object newValue) { | ||
175 | switch (featureID) { | ||
176 | case SimpleStatechartPackage.STATECHART__STATE: | ||
177 | getState().clear(); | ||
178 | getState().addAll((Collection<? extends State>)newValue); | ||
179 | return; | ||
180 | case SimpleStatechartPackage.STATECHART__ENTRY: | ||
181 | setEntry((Entry)newValue); | ||
182 | return; | ||
183 | } | ||
184 | super.eSet(featureID, newValue); | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * <!-- begin-user-doc --> | ||
189 | * <!-- end-user-doc --> | ||
190 | * @generated | ||
191 | */ | ||
192 | @Override | ||
193 | public void eUnset(int featureID) { | ||
194 | switch (featureID) { | ||
195 | case SimpleStatechartPackage.STATECHART__STATE: | ||
196 | getState().clear(); | ||
197 | return; | ||
198 | case SimpleStatechartPackage.STATECHART__ENTRY: | ||
199 | setEntry((Entry)null); | ||
200 | return; | ||
201 | } | ||
202 | super.eUnset(featureID); | ||
203 | } | ||
204 | |||
205 | /** | ||
206 | * <!-- begin-user-doc --> | ||
207 | * <!-- end-user-doc --> | ||
208 | * @generated | ||
209 | */ | ||
210 | @Override | ||
211 | public boolean eIsSet(int featureID) { | ||
212 | switch (featureID) { | ||
213 | case SimpleStatechartPackage.STATECHART__STATE: | ||
214 | return state != null && !state.isEmpty(); | ||
215 | case SimpleStatechartPackage.STATECHART__ENTRY: | ||
216 | return entry != null; | ||
217 | } | ||
218 | return super.eIsSet(featureID); | ||
219 | } | ||
220 | |||
221 | } //StatechartImpl | ||