1 | /** |
---|
2 | * <copyright> |
---|
3 | * </copyright> |
---|
4 | * |
---|
5 | */ |
---|
6 | package org.modelica.xtext.modelicaBase.impl; |
---|
7 | |
---|
8 | import java.util.Collection; |
---|
9 | |
---|
10 | import org.eclipse.emf.common.notify.Notification; |
---|
11 | import org.eclipse.emf.common.notify.NotificationChain; |
---|
12 | |
---|
13 | import org.eclipse.emf.common.util.EList; |
---|
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.EObjectContainmentEList; |
---|
21 | import org.eclipse.emf.ecore.util.InternalEList; |
---|
22 | |
---|
23 | import org.modelica.xtext.modelicaBase.ForAlgorithmClause; |
---|
24 | import org.modelica.xtext.modelicaBase.ModelicaBasePackage; |
---|
25 | import org.modelica.xtext.modelicaBase.algorithm; |
---|
26 | |
---|
27 | /** |
---|
28 | * <!-- begin-user-doc --> |
---|
29 | * An implementation of the model object '<em><b>For Algorithm Clause</b></em>'. |
---|
30 | * <!-- end-user-doc --> |
---|
31 | * <p> |
---|
32 | * The following features are implemented: |
---|
33 | * <ul> |
---|
34 | * <li>{@link org.modelica.xtext.modelicaBase.impl.ForAlgorithmClauseImpl#getForIndices <em>For Indices</em>}</li> |
---|
35 | * <li>{@link org.modelica.xtext.modelicaBase.impl.ForAlgorithmClauseImpl#getAlgorithmClauses <em>Algorithm Clauses</em>}</li> |
---|
36 | * </ul> |
---|
37 | * </p> |
---|
38 | * |
---|
39 | * @generated |
---|
40 | */ |
---|
41 | public class ForAlgorithmClauseImpl extends algorithmImpl implements ForAlgorithmClause |
---|
42 | { |
---|
43 | /** |
---|
44 | * The default value of the '{@link #getForIndices() <em>For Indices</em>}' attribute. |
---|
45 | * <!-- begin-user-doc --> |
---|
46 | * <!-- end-user-doc --> |
---|
47 | * @see #getForIndices() |
---|
48 | * @generated |
---|
49 | * @ordered |
---|
50 | */ |
---|
51 | protected static final String FOR_INDICES_EDEFAULT = null; |
---|
52 | |
---|
53 | /** |
---|
54 | * The cached value of the '{@link #getForIndices() <em>For Indices</em>}' attribute. |
---|
55 | * <!-- begin-user-doc --> |
---|
56 | * <!-- end-user-doc --> |
---|
57 | * @see #getForIndices() |
---|
58 | * @generated |
---|
59 | * @ordered |
---|
60 | */ |
---|
61 | protected String forIndices = FOR_INDICES_EDEFAULT; |
---|
62 | |
---|
63 | /** |
---|
64 | * The cached value of the '{@link #getAlgorithmClauses() <em>Algorithm Clauses</em>}' containment reference list. |
---|
65 | * <!-- begin-user-doc --> |
---|
66 | * <!-- end-user-doc --> |
---|
67 | * @see #getAlgorithmClauses() |
---|
68 | * @generated |
---|
69 | * @ordered |
---|
70 | */ |
---|
71 | protected EList<algorithm> algorithmClauses; |
---|
72 | |
---|
73 | /** |
---|
74 | * <!-- begin-user-doc --> |
---|
75 | * <!-- end-user-doc --> |
---|
76 | * @generated |
---|
77 | */ |
---|
78 | protected ForAlgorithmClauseImpl() |
---|
79 | { |
---|
80 | super(); |
---|
81 | } |
---|
82 | |
---|
83 | /** |
---|
84 | * <!-- begin-user-doc --> |
---|
85 | * <!-- end-user-doc --> |
---|
86 | * @generated |
---|
87 | */ |
---|
88 | @Override |
---|
89 | protected EClass eStaticClass() |
---|
90 | { |
---|
91 | return ModelicaBasePackage.Literals.FOR_ALGORITHM_CLAUSE; |
---|
92 | } |
---|
93 | |
---|
94 | /** |
---|
95 | * <!-- begin-user-doc --> |
---|
96 | * <!-- end-user-doc --> |
---|
97 | * @generated |
---|
98 | */ |
---|
99 | public String getForIndices() |
---|
100 | { |
---|
101 | return forIndices; |
---|
102 | } |
---|
103 | |
---|
104 | /** |
---|
105 | * <!-- begin-user-doc --> |
---|
106 | * <!-- end-user-doc --> |
---|
107 | * @generated |
---|
108 | */ |
---|
109 | public void setForIndices(String newForIndices) |
---|
110 | { |
---|
111 | String oldForIndices = forIndices; |
---|
112 | forIndices = newForIndices; |
---|
113 | if (eNotificationRequired()) |
---|
114 | eNotify(new ENotificationImpl(this, Notification.SET, ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__FOR_INDICES, oldForIndices, forIndices)); |
---|
115 | } |
---|
116 | |
---|
117 | /** |
---|
118 | * <!-- begin-user-doc --> |
---|
119 | * <!-- end-user-doc --> |
---|
120 | * @generated |
---|
121 | */ |
---|
122 | public EList<algorithm> getAlgorithmClauses() |
---|
123 | { |
---|
124 | if (algorithmClauses == null) |
---|
125 | { |
---|
126 | algorithmClauses = new EObjectContainmentEList<algorithm>(algorithm.class, this, ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__ALGORITHM_CLAUSES); |
---|
127 | } |
---|
128 | return algorithmClauses; |
---|
129 | } |
---|
130 | |
---|
131 | /** |
---|
132 | * <!-- begin-user-doc --> |
---|
133 | * <!-- end-user-doc --> |
---|
134 | * @generated |
---|
135 | */ |
---|
136 | @Override |
---|
137 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
---|
138 | { |
---|
139 | switch (featureID) |
---|
140 | { |
---|
141 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__ALGORITHM_CLAUSES: |
---|
142 | return ((InternalEList<?>)getAlgorithmClauses()).basicRemove(otherEnd, msgs); |
---|
143 | } |
---|
144 | return super.eInverseRemove(otherEnd, featureID, msgs); |
---|
145 | } |
---|
146 | |
---|
147 | /** |
---|
148 | * <!-- begin-user-doc --> |
---|
149 | * <!-- end-user-doc --> |
---|
150 | * @generated |
---|
151 | */ |
---|
152 | @Override |
---|
153 | public Object eGet(int featureID, boolean resolve, boolean coreType) |
---|
154 | { |
---|
155 | switch (featureID) |
---|
156 | { |
---|
157 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__FOR_INDICES: |
---|
158 | return getForIndices(); |
---|
159 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__ALGORITHM_CLAUSES: |
---|
160 | return getAlgorithmClauses(); |
---|
161 | } |
---|
162 | return super.eGet(featureID, resolve, coreType); |
---|
163 | } |
---|
164 | |
---|
165 | /** |
---|
166 | * <!-- begin-user-doc --> |
---|
167 | * <!-- end-user-doc --> |
---|
168 | * @generated |
---|
169 | */ |
---|
170 | @SuppressWarnings("unchecked") |
---|
171 | @Override |
---|
172 | public void eSet(int featureID, Object newValue) |
---|
173 | { |
---|
174 | switch (featureID) |
---|
175 | { |
---|
176 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__FOR_INDICES: |
---|
177 | setForIndices((String)newValue); |
---|
178 | return; |
---|
179 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__ALGORITHM_CLAUSES: |
---|
180 | getAlgorithmClauses().clear(); |
---|
181 | getAlgorithmClauses().addAll((Collection<? extends algorithm>)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 | { |
---|
195 | switch (featureID) |
---|
196 | { |
---|
197 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__FOR_INDICES: |
---|
198 | setForIndices(FOR_INDICES_EDEFAULT); |
---|
199 | return; |
---|
200 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__ALGORITHM_CLAUSES: |
---|
201 | getAlgorithmClauses().clear(); |
---|
202 | return; |
---|
203 | } |
---|
204 | super.eUnset(featureID); |
---|
205 | } |
---|
206 | |
---|
207 | /** |
---|
208 | * <!-- begin-user-doc --> |
---|
209 | * <!-- end-user-doc --> |
---|
210 | * @generated |
---|
211 | */ |
---|
212 | @Override |
---|
213 | public boolean eIsSet(int featureID) |
---|
214 | { |
---|
215 | switch (featureID) |
---|
216 | { |
---|
217 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__FOR_INDICES: |
---|
218 | return FOR_INDICES_EDEFAULT == null ? forIndices != null : !FOR_INDICES_EDEFAULT.equals(forIndices); |
---|
219 | case ModelicaBasePackage.FOR_ALGORITHM_CLAUSE__ALGORITHM_CLAUSES: |
---|
220 | return algorithmClauses != null && !algorithmClauses.isEmpty(); |
---|
221 | } |
---|
222 | return super.eIsSet(featureID); |
---|
223 | } |
---|
224 | |
---|
225 | /** |
---|
226 | * <!-- begin-user-doc --> |
---|
227 | * <!-- end-user-doc --> |
---|
228 | * @generated |
---|
229 | */ |
---|
230 | @Override |
---|
231 | public String toString() |
---|
232 | { |
---|
233 | if (eIsProxy()) return super.toString(); |
---|
234 | |
---|
235 | StringBuffer result = new StringBuffer(super.toString()); |
---|
236 | result.append(" (forIndices: "); |
---|
237 | result.append(forIndices); |
---|
238 | result.append(')'); |
---|
239 | return result.toString(); |
---|
240 | } |
---|
241 | |
---|
242 | } //ForAlgorithmClauseImpl |
---|