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