1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featuremodel.impl; |
8 | |
9 | import org.eclipse.emf.common.notify.Notification; |
10 | import org.eclipse.emf.common.notify.NotificationChain; |
11 | import org.eclipse.emf.ecore.EClass; |
12 | import org.eclipse.emf.ecore.InternalEObject; |
13 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
14 | |
15 | import de.uka.ipd.sdq.featuremodel.Attribute; |
16 | import de.uka.ipd.sdq.featuremodel.IntervalRange; |
17 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
18 | |
19 | /** |
20 | * <!-- begin-user-doc --> |
21 | * An implementation of the model object '<em><b>Attribute</b></em>'. |
22 | * <!-- end-user-doc --> |
23 | * <p> |
24 | * The following features are implemented: |
25 | * <ul> |
26 | * <li>{@link de.uka.ipd.sdq.featuremodel.impl.AttributeImpl#getRange <em>Range</em>}</li> |
27 | * </ul> |
28 | * </p> |
29 | * |
30 | * @generated |
31 | */ |
32 | public abstract class AttributeImpl extends NamedElementImpl implements Attribute { |
33 | /** |
34 | * The cached value of the '{@link #getRange() <em>Range</em>}' containment reference. |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @see #getRange() |
38 | * @generated |
39 | * @ordered |
40 | */ |
41 | protected IntervalRange range; |
42 | |
43 | /** |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | protected AttributeImpl() { |
49 | super(); |
50 | } |
51 | |
52 | /** |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | @Override |
58 | protected EClass eStaticClass() { |
59 | return featuremodelPackage.Literals.ATTRIBUTE; |
60 | } |
61 | |
62 | /** |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | public IntervalRange getRange() { |
68 | return range; |
69 | } |
70 | |
71 | /** |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | public NotificationChain basicSetRange(IntervalRange newRange, NotificationChain msgs) { |
77 | IntervalRange oldRange = range; |
78 | range = newRange; |
79 | if (eNotificationRequired()) { |
80 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, featuremodelPackage.ATTRIBUTE__RANGE, oldRange, newRange); |
81 | if (msgs == null) msgs = notification; else msgs.add(notification); |
82 | } |
83 | return msgs; |
84 | } |
85 | |
86 | /** |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | public void setRange(IntervalRange newRange) { |
92 | if (newRange != range) { |
93 | NotificationChain msgs = null; |
94 | if (range != null) |
95 | msgs = ((InternalEObject)range).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - featuremodelPackage.ATTRIBUTE__RANGE, null, msgs); |
96 | if (newRange != null) |
97 | msgs = ((InternalEObject)newRange).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - featuremodelPackage.ATTRIBUTE__RANGE, null, msgs); |
98 | msgs = basicSetRange(newRange, msgs); |
99 | if (msgs != null) msgs.dispatch(); |
100 | } |
101 | else if (eNotificationRequired()) |
102 | eNotify(new ENotificationImpl(this, Notification.SET, featuremodelPackage.ATTRIBUTE__RANGE, newRange, newRange)); |
103 | } |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | @Override |
111 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
112 | switch (featureID) { |
113 | case featuremodelPackage.ATTRIBUTE__RANGE: |
114 | return basicSetRange(null, msgs); |
115 | } |
116 | return super.eInverseRemove(otherEnd, featureID, msgs); |
117 | } |
118 | |
119 | /** |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
126 | switch (featureID) { |
127 | case featuremodelPackage.ATTRIBUTE__RANGE: |
128 | return getRange(); |
129 | } |
130 | return super.eGet(featureID, resolve, coreType); |
131 | } |
132 | |
133 | /** |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public void eSet(int featureID, Object newValue) { |
140 | switch (featureID) { |
141 | case featuremodelPackage.ATTRIBUTE__RANGE: |
142 | setRange((IntervalRange)newValue); |
143 | return; |
144 | } |
145 | super.eSet(featureID, newValue); |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public void eUnset(int featureID) { |
155 | switch (featureID) { |
156 | case featuremodelPackage.ATTRIBUTE__RANGE: |
157 | setRange((IntervalRange)null); |
158 | return; |
159 | } |
160 | super.eUnset(featureID); |
161 | } |
162 | |
163 | /** |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | @Override |
169 | public boolean eIsSet(int featureID) { |
170 | switch (featureID) { |
171 | case featuremodelPackage.ATTRIBUTE__RANGE: |
172 | return range != null; |
173 | } |
174 | return super.eIsSet(featureID); |
175 | } |
176 | |
177 | } //AttributeImpl |