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