1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.reliability.impl; |
7 | |
8 | import org.eclipse.emf.common.notify.Notification; |
9 | import org.eclipse.emf.common.notify.NotificationChain; |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.InternalEObject; |
12 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
13 | import org.eclipse.emf.ecore.util.EcoreUtil; |
14 | |
15 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
16 | import de.uka.ipd.sdq.pcm.reliability.FailureType; |
17 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage; |
18 | import de.uka.ipd.sdq.pcm.repository.Repository; |
19 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
20 | |
21 | /** |
22 | * <!-- begin-user-doc --> |
23 | * An implementation of the model object '<em><b>Failure Type</b></em>'. |
24 | * <!-- end-user-doc --> |
25 | * <p> |
26 | * The following features are implemented: |
27 | * <ul> |
28 | * <li>{@link de.uka.ipd.sdq.pcm.reliability.impl.FailureTypeImpl#getRepository__FailureType <em>Repository Failure Type</em>}</li> |
29 | * </ul> |
30 | * </p> |
31 | * |
32 | * @generated |
33 | */ |
34 | public abstract class FailureTypeImpl extends EntityImpl implements FailureType { |
35 | /** |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
41 | |
42 | /** |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | protected FailureTypeImpl() { |
48 | super(); |
49 | } |
50 | |
51 | /** |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @generated |
55 | */ |
56 | @Override |
57 | protected EClass eStaticClass() { |
58 | return ReliabilityPackage.Literals.FAILURE_TYPE; |
59 | } |
60 | |
61 | /** |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | public Repository getRepository__FailureType() { |
67 | if (eContainerFeatureID() != ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE) return null; |
68 | return (Repository)eContainer(); |
69 | } |
70 | |
71 | /** |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | public NotificationChain basicSetRepository__FailureType(Repository newRepository__FailureType, NotificationChain msgs) { |
77 | msgs = eBasicSetContainer((InternalEObject)newRepository__FailureType, ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE, msgs); |
78 | return msgs; |
79 | } |
80 | |
81 | /** |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | public void setRepository__FailureType(Repository newRepository__FailureType) { |
87 | if (newRepository__FailureType != eInternalContainer() || (eContainerFeatureID() != ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE && newRepository__FailureType != null)) { |
88 | if (EcoreUtil.isAncestor(this, newRepository__FailureType)) |
89 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
90 | NotificationChain msgs = null; |
91 | if (eInternalContainer() != null) |
92 | msgs = eBasicRemoveFromContainer(msgs); |
93 | if (newRepository__FailureType != null) |
94 | msgs = ((InternalEObject)newRepository__FailureType).eInverseAdd(this, RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY, Repository.class, msgs); |
95 | msgs = basicSetRepository__FailureType(newRepository__FailureType, msgs); |
96 | if (msgs != null) msgs.dispatch(); |
97 | } |
98 | else if (eNotificationRequired()) |
99 | eNotify(new ENotificationImpl(this, Notification.SET, ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE, newRepository__FailureType, newRepository__FailureType)); |
100 | } |
101 | |
102 | /** |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | @Override |
108 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
109 | switch (featureID) { |
110 | case ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE: |
111 | if (eInternalContainer() != null) |
112 | msgs = eBasicRemoveFromContainer(msgs); |
113 | return basicSetRepository__FailureType((Repository)otherEnd, msgs); |
114 | } |
115 | return super.eInverseAdd(otherEnd, featureID, msgs); |
116 | } |
117 | |
118 | /** |
119 | * <!-- begin-user-doc --> |
120 | * <!-- end-user-doc --> |
121 | * @generated |
122 | */ |
123 | @Override |
124 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
125 | switch (featureID) { |
126 | case ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE: |
127 | return basicSetRepository__FailureType(null, msgs); |
128 | } |
129 | return super.eInverseRemove(otherEnd, featureID, msgs); |
130 | } |
131 | |
132 | /** |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | @Override |
138 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
139 | switch (eContainerFeatureID()) { |
140 | case ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE: |
141 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.REPOSITORY__FAILURE_TYPES_REPOSITORY, Repository.class, msgs); |
142 | } |
143 | return super.eBasicRemoveFromContainerFeature(msgs); |
144 | } |
145 | |
146 | /** |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
153 | switch (featureID) { |
154 | case ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE: |
155 | return getRepository__FailureType(); |
156 | } |
157 | return super.eGet(featureID, resolve, coreType); |
158 | } |
159 | |
160 | /** |
161 | * <!-- begin-user-doc --> |
162 | * <!-- end-user-doc --> |
163 | * @generated |
164 | */ |
165 | @Override |
166 | public void eSet(int featureID, Object newValue) { |
167 | switch (featureID) { |
168 | case ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE: |
169 | setRepository__FailureType((Repository)newValue); |
170 | return; |
171 | } |
172 | super.eSet(featureID, newValue); |
173 | } |
174 | |
175 | /** |
176 | * <!-- begin-user-doc --> |
177 | * <!-- end-user-doc --> |
178 | * @generated |
179 | */ |
180 | @Override |
181 | public void eUnset(int featureID) { |
182 | switch (featureID) { |
183 | case ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE: |
184 | setRepository__FailureType((Repository)null); |
185 | return; |
186 | } |
187 | super.eUnset(featureID); |
188 | } |
189 | |
190 | /** |
191 | * <!-- begin-user-doc --> |
192 | * <!-- end-user-doc --> |
193 | * @generated |
194 | */ |
195 | @Override |
196 | public boolean eIsSet(int featureID) { |
197 | switch (featureID) { |
198 | case ReliabilityPackage.FAILURE_TYPE__REPOSITORY_FAILURE_TYPE: |
199 | return getRepository__FailureType() != null; |
200 | } |
201 | return super.eIsSet(featureID); |
202 | } |
203 | |
204 | } //FailureTypeImpl |