1 | /** |
---|
2 | */ |
---|
3 | package de.ugoe.cs.swe.bnftools.ebnf.impl; |
---|
4 | |
---|
5 | import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage; |
---|
6 | import de.ugoe.cs.swe.bnftools.ebnf.RuleCombinator; |
---|
7 | |
---|
8 | import java.util.Collection; |
---|
9 | |
---|
10 | import org.eclipse.emf.common.notify.Notification; |
---|
11 | |
---|
12 | import org.eclipse.emf.common.util.EList; |
---|
13 | |
---|
14 | import org.eclipse.emf.ecore.EClass; |
---|
15 | |
---|
16 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
---|
17 | |
---|
18 | import org.eclipse.emf.ecore.util.EDataTypeEList; |
---|
19 | |
---|
20 | /** |
---|
21 | * <!-- begin-user-doc --> |
---|
22 | * An implementation of the model object '<em><b>Rule Combinator</b></em>'. |
---|
23 | * <!-- end-user-doc --> |
---|
24 | * <p> |
---|
25 | * The following features are implemented: |
---|
26 | * <ul> |
---|
27 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleCombinatorImpl#getName <em>Name</em>}</li> |
---|
28 | * <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.RuleCombinatorImpl#getLABEL <em>LABEL</em>}</li> |
---|
29 | * </ul> |
---|
30 | * </p> |
---|
31 | * |
---|
32 | * @generated |
---|
33 | */ |
---|
34 | public class RuleCombinatorImpl extends MergeRuleImpl implements RuleCombinator |
---|
35 | { |
---|
36 | /** |
---|
37 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
---|
38 | * <!-- begin-user-doc --> |
---|
39 | * <!-- end-user-doc --> |
---|
40 | * @see #getName() |
---|
41 | * @generated |
---|
42 | * @ordered |
---|
43 | */ |
---|
44 | protected static final String NAME_EDEFAULT = null; |
---|
45 | |
---|
46 | /** |
---|
47 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
---|
48 | * <!-- begin-user-doc --> |
---|
49 | * <!-- end-user-doc --> |
---|
50 | * @see #getName() |
---|
51 | * @generated |
---|
52 | * @ordered |
---|
53 | */ |
---|
54 | protected String name = NAME_EDEFAULT; |
---|
55 | |
---|
56 | /** |
---|
57 | * The cached value of the '{@link #getLABEL() <em>LABEL</em>}' attribute list. |
---|
58 | * <!-- begin-user-doc --> |
---|
59 | * <!-- end-user-doc --> |
---|
60 | * @see #getLABEL() |
---|
61 | * @generated |
---|
62 | * @ordered |
---|
63 | */ |
---|
64 | protected EList<String> label; |
---|
65 | |
---|
66 | /** |
---|
67 | * <!-- begin-user-doc --> |
---|
68 | * <!-- end-user-doc --> |
---|
69 | * @generated |
---|
70 | */ |
---|
71 | protected RuleCombinatorImpl() |
---|
72 | { |
---|
73 | super(); |
---|
74 | } |
---|
75 | |
---|
76 | /** |
---|
77 | * <!-- begin-user-doc --> |
---|
78 | * <!-- end-user-doc --> |
---|
79 | * @generated |
---|
80 | */ |
---|
81 | @Override |
---|
82 | protected EClass eStaticClass() |
---|
83 | { |
---|
84 | return EbnfPackage.Literals.RULE_COMBINATOR; |
---|
85 | } |
---|
86 | |
---|
87 | /** |
---|
88 | * <!-- begin-user-doc --> |
---|
89 | * <!-- end-user-doc --> |
---|
90 | * @generated |
---|
91 | */ |
---|
92 | public String getName() |
---|
93 | { |
---|
94 | return name; |
---|
95 | } |
---|
96 | |
---|
97 | /** |
---|
98 | * <!-- begin-user-doc --> |
---|
99 | * <!-- end-user-doc --> |
---|
100 | * @generated |
---|
101 | */ |
---|
102 | public void setName(String newName) |
---|
103 | { |
---|
104 | String oldName = name; |
---|
105 | name = newName; |
---|
106 | if (eNotificationRequired()) |
---|
107 | eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.RULE_COMBINATOR__NAME, oldName, name)); |
---|
108 | } |
---|
109 | |
---|
110 | /** |
---|
111 | * <!-- begin-user-doc --> |
---|
112 | * <!-- end-user-doc --> |
---|
113 | * @generated |
---|
114 | */ |
---|
115 | public EList<String> getLABEL() |
---|
116 | { |
---|
117 | if (label == null) |
---|
118 | { |
---|
119 | label = new EDataTypeEList<String>(String.class, this, EbnfPackage.RULE_COMBINATOR__LABEL); |
---|
120 | } |
---|
121 | return label; |
---|
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 | { |
---|
132 | switch (featureID) |
---|
133 | { |
---|
134 | case EbnfPackage.RULE_COMBINATOR__NAME: |
---|
135 | return getName(); |
---|
136 | case EbnfPackage.RULE_COMBINATOR__LABEL: |
---|
137 | return getLABEL(); |
---|
138 | } |
---|
139 | return super.eGet(featureID, resolve, coreType); |
---|
140 | } |
---|
141 | |
---|
142 | /** |
---|
143 | * <!-- begin-user-doc --> |
---|
144 | * <!-- end-user-doc --> |
---|
145 | * @generated |
---|
146 | */ |
---|
147 | @SuppressWarnings("unchecked") |
---|
148 | @Override |
---|
149 | public void eSet(int featureID, Object newValue) |
---|
150 | { |
---|
151 | switch (featureID) |
---|
152 | { |
---|
153 | case EbnfPackage.RULE_COMBINATOR__NAME: |
---|
154 | setName((String)newValue); |
---|
155 | return; |
---|
156 | case EbnfPackage.RULE_COMBINATOR__LABEL: |
---|
157 | getLABEL().clear(); |
---|
158 | getLABEL().addAll((Collection<? extends String>)newValue); |
---|
159 | return; |
---|
160 | } |
---|
161 | super.eSet(featureID, newValue); |
---|
162 | } |
---|
163 | |
---|
164 | /** |
---|
165 | * <!-- begin-user-doc --> |
---|
166 | * <!-- end-user-doc --> |
---|
167 | * @generated |
---|
168 | */ |
---|
169 | @Override |
---|
170 | public void eUnset(int featureID) |
---|
171 | { |
---|
172 | switch (featureID) |
---|
173 | { |
---|
174 | case EbnfPackage.RULE_COMBINATOR__NAME: |
---|
175 | setName(NAME_EDEFAULT); |
---|
176 | return; |
---|
177 | case EbnfPackage.RULE_COMBINATOR__LABEL: |
---|
178 | getLABEL().clear(); |
---|
179 | return; |
---|
180 | } |
---|
181 | super.eUnset(featureID); |
---|
182 | } |
---|
183 | |
---|
184 | /** |
---|
185 | * <!-- begin-user-doc --> |
---|
186 | * <!-- end-user-doc --> |
---|
187 | * @generated |
---|
188 | */ |
---|
189 | @Override |
---|
190 | public boolean eIsSet(int featureID) |
---|
191 | { |
---|
192 | switch (featureID) |
---|
193 | { |
---|
194 | case EbnfPackage.RULE_COMBINATOR__NAME: |
---|
195 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
---|
196 | case EbnfPackage.RULE_COMBINATOR__LABEL: |
---|
197 | return label != null && !label.isEmpty(); |
---|
198 | } |
---|
199 | return super.eIsSet(featureID); |
---|
200 | } |
---|
201 | |
---|
202 | /** |
---|
203 | * <!-- begin-user-doc --> |
---|
204 | * <!-- end-user-doc --> |
---|
205 | * @generated |
---|
206 | */ |
---|
207 | @Override |
---|
208 | public String toString() |
---|
209 | { |
---|
210 | if (eIsProxy()) return super.toString(); |
---|
211 | |
---|
212 | StringBuffer result = new StringBuffer(super.toString()); |
---|
213 | result.append(" (name: "); |
---|
214 | result.append(name); |
---|
215 | result.append(", LABEL: "); |
---|
216 | result.append(label); |
---|
217 | result.append(')'); |
---|
218 | return result.toString(); |
---|
219 | } |
---|
220 | |
---|
221 | } //RuleCombinatorImpl |
---|