1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EMOF.impl; |
8 | |
9 | import EMOF.EMOFPackage; |
10 | import EMOF.Type; |
11 | |
12 | import org.eclipse.emf.common.notify.Notification; |
13 | import org.eclipse.emf.common.notify.NotificationChain; |
14 | |
15 | import org.eclipse.emf.ecore.EClass; |
16 | import org.eclipse.emf.ecore.InternalEObject; |
17 | |
18 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
19 | |
20 | import org.eclipse.emf.ecore.util.EcoreUtil; |
21 | |
22 | /** |
23 | * <!-- begin-user-doc --> |
24 | * An implementation of the model object '<em><b>Type</b></em>'. |
25 | * <!-- end-user-doc --> |
26 | * <p> |
27 | * The following features are implemented: |
28 | * <ul> |
29 | * <li>{@link EMOF.impl.TypeImpl#getPackage <em>Package</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public abstract class TypeImpl extends NamedElementImpl implements Type { |
36 | /** |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | protected TypeImpl() { |
42 | super(); |
43 | } |
44 | |
45 | /** |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @generated |
49 | */ |
50 | @Override |
51 | protected EClass eStaticClass() { |
52 | return EMOFPackage.Literals.TYPE; |
53 | } |
54 | |
55 | /** |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | public EMOF.Package getPackage() { |
61 | if (eContainerFeatureID() != EMOFPackage.TYPE__PACKAGE) return null; |
62 | return (EMOF.Package)eContainer(); |
63 | } |
64 | |
65 | /** |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | public NotificationChain basicSetPackage(EMOF.Package newPackage, NotificationChain msgs) { |
71 | msgs = eBasicSetContainer((InternalEObject)newPackage, EMOFPackage.TYPE__PACKAGE, msgs); |
72 | return msgs; |
73 | } |
74 | |
75 | /** |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | public void setPackage(EMOF.Package newPackage) { |
81 | if (newPackage != eInternalContainer() || (eContainerFeatureID() != EMOFPackage.TYPE__PACKAGE && newPackage != null)) { |
82 | if (EcoreUtil.isAncestor(this, newPackage)) |
83 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
84 | NotificationChain msgs = null; |
85 | if (eInternalContainer() != null) |
86 | msgs = eBasicRemoveFromContainer(msgs); |
87 | if (newPackage != null) |
88 | msgs = ((InternalEObject)newPackage).eInverseAdd(this, EMOFPackage.PACKAGE__OWNED_TYPE, EMOF.Package.class, msgs); |
89 | msgs = basicSetPackage(newPackage, msgs); |
90 | if (msgs != null) msgs.dispatch(); |
91 | } |
92 | else if (eNotificationRequired()) |
93 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.TYPE__PACKAGE, newPackage, newPackage)); |
94 | } |
95 | |
96 | /** |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | public Boolean isInstance(EMOF.Object object) { |
102 | // TODO: implement this method |
103 | // Ensure that you remove @generated or mark it @generated NOT |
104 | throw new UnsupportedOperationException(); |
105 | } |
106 | |
107 | /** |
108 | * <!-- begin-user-doc --> |
109 | * <!-- end-user-doc --> |
110 | * @generated |
111 | */ |
112 | @Override |
113 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
114 | switch (featureID) { |
115 | case EMOFPackage.TYPE__PACKAGE: |
116 | if (eInternalContainer() != null) |
117 | msgs = eBasicRemoveFromContainer(msgs); |
118 | return basicSetPackage((EMOF.Package)otherEnd, msgs); |
119 | } |
120 | return super.eInverseAdd(otherEnd, featureID, msgs); |
121 | } |
122 | |
123 | /** |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | @Override |
129 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
130 | switch (featureID) { |
131 | case EMOFPackage.TYPE__PACKAGE: |
132 | return basicSetPackage(null, msgs); |
133 | } |
134 | return super.eInverseRemove(otherEnd, featureID, msgs); |
135 | } |
136 | |
137 | /** |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | @Override |
143 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
144 | switch (eContainerFeatureID()) { |
145 | case EMOFPackage.TYPE__PACKAGE: |
146 | return eInternalContainer().eInverseRemove(this, EMOFPackage.PACKAGE__OWNED_TYPE, EMOF.Package.class, msgs); |
147 | } |
148 | return super.eBasicRemoveFromContainerFeature(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 EMOFPackage.TYPE__PACKAGE: |
160 | return getPackage(); |
161 | } |
162 | return super.eGet(featureID, resolve, coreType); |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | @Override |
171 | public void eSet(int featureID, Object newValue) { |
172 | switch (featureID) { |
173 | case EMOFPackage.TYPE__PACKAGE: |
174 | setPackage((EMOF.Package)newValue); |
175 | return; |
176 | } |
177 | super.eSet(featureID, newValue); |
178 | } |
179 | |
180 | /** |
181 | * <!-- begin-user-doc --> |
182 | * <!-- end-user-doc --> |
183 | * @generated |
184 | */ |
185 | @Override |
186 | public void eUnset(int featureID) { |
187 | switch (featureID) { |
188 | case EMOFPackage.TYPE__PACKAGE: |
189 | setPackage((EMOF.Package)null); |
190 | return; |
191 | } |
192 | super.eUnset(featureID); |
193 | } |
194 | |
195 | /** |
196 | * <!-- begin-user-doc --> |
197 | * <!-- end-user-doc --> |
198 | * @generated |
199 | */ |
200 | @Override |
201 | public boolean eIsSet(int featureID) { |
202 | switch (featureID) { |
203 | case EMOFPackage.TYPE__PACKAGE: |
204 | return getPackage() != null; |
205 | } |
206 | return super.eIsSet(featureID); |
207 | } |
208 | |
209 | } //TypeImpl |