1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.units.impl; |
8 | |
9 | import de.uka.ipd.sdq.units.Unit; |
10 | import de.uka.ipd.sdq.units.UnitCarryingElement; |
11 | import de.uka.ipd.sdq.units.UnitsPackage; |
12 | |
13 | import org.eclipse.emf.common.notify.Notification; |
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 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
20 | |
21 | /** |
22 | * <!-- begin-user-doc --> |
23 | * An implementation of the model object '<em><b>Unit Carrying Element</b></em>'. |
24 | * <!-- end-user-doc --> |
25 | * <p> |
26 | * The following features are implemented: |
27 | * <ul> |
28 | * <li>{@link de.uka.ipd.sdq.units.impl.UnitCarryingElementImpl#getUnit <em>Unit</em>}</li> |
29 | * <li>{@link de.uka.ipd.sdq.units.impl.UnitCarryingElementImpl#getUnitSpecification <em>Unit Specification</em>}</li> |
30 | * </ul> |
31 | * </p> |
32 | * |
33 | * @generated |
34 | */ |
35 | public abstract class UnitCarryingElementImpl extends EObjectImpl implements UnitCarryingElement { |
36 | /** |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
42 | |
43 | /** |
44 | * The default value of the '{@link #getUnitSpecification() <em>Unit Specification</em>}' attribute. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @see #getUnitSpecification() |
48 | * @generated |
49 | * @ordered |
50 | */ |
51 | protected static final String UNIT_SPECIFICATION_EDEFAULT = null; |
52 | |
53 | /** |
54 | * The cached value of the '{@link #getUnitSpecification() <em>Unit Specification</em>}' attribute. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @see #getUnitSpecification() |
58 | * @generated |
59 | * @ordered |
60 | */ |
61 | protected String unitSpecification = UNIT_SPECIFICATION_EDEFAULT; |
62 | |
63 | /** |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | protected UnitCarryingElementImpl() { |
69 | super(); |
70 | } |
71 | |
72 | /** |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | @Override |
78 | protected EClass eStaticClass() { |
79 | return UnitsPackage.Literals.UNIT_CARRYING_ELEMENT; |
80 | } |
81 | |
82 | /** |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | public Unit getUnit() { |
88 | Unit unit = basicGetUnit(); |
89 | return unit != null && unit.eIsProxy() ? (Unit)eResolveProxy((InternalEObject)unit) : unit; |
90 | } |
91 | |
92 | /** |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated not |
96 | */ |
97 | public Unit basicGetUnit() { |
98 | // TODO: implement this method to return the 'Unit' reference |
99 | // -> do not perform proxy resolution |
100 | // Ensure that you remove @generated or mark it @generated NOT |
101 | |
102 | return null; |
103 | } |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | public void setUnit(Unit newUnit) { |
111 | // TODO: implement this method to set the 'Unit' reference |
112 | // Ensure that you remove @generated or mark it @generated NOT |
113 | throw new UnsupportedOperationException(); |
114 | } |
115 | |
116 | /** |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | public String getUnitSpecification() { |
122 | return unitSpecification; |
123 | } |
124 | |
125 | /** |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | public void setUnitSpecification(String newUnitSpecification) { |
131 | String oldUnitSpecification = unitSpecification; |
132 | unitSpecification = newUnitSpecification; |
133 | if (eNotificationRequired()) |
134 | eNotify(new ENotificationImpl(this, Notification.SET, UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT_SPECIFICATION, oldUnitSpecification, unitSpecification)); |
135 | } |
136 | |
137 | /** |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | @Override |
143 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
144 | switch (featureID) { |
145 | case UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT: |
146 | if (resolve) return getUnit(); |
147 | return basicGetUnit(); |
148 | case UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT_SPECIFICATION: |
149 | return getUnitSpecification(); |
150 | } |
151 | return super.eGet(featureID, resolve, coreType); |
152 | } |
153 | |
154 | /** |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | @Override |
160 | public void eSet(int featureID, Object newValue) { |
161 | switch (featureID) { |
162 | case UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT: |
163 | setUnit((Unit)newValue); |
164 | return; |
165 | case UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT_SPECIFICATION: |
166 | setUnitSpecification((String)newValue); |
167 | return; |
168 | } |
169 | super.eSet(featureID, newValue); |
170 | } |
171 | |
172 | /** |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | @Override |
178 | public void eUnset(int featureID) { |
179 | switch (featureID) { |
180 | case UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT: |
181 | setUnit((Unit)null); |
182 | return; |
183 | case UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT_SPECIFICATION: |
184 | setUnitSpecification(UNIT_SPECIFICATION_EDEFAULT); |
185 | return; |
186 | } |
187 | super.eUnset(featureID); |
188 | } |
189 | |
190 | /** |
191 | * <!-- begin-user-doc --> |
192 | * <!-- end-user-doc --> |
193 | * @generated |
194 | */ |
195 | @Override |
196 | public boolean eIsSet(int featureID) { |
197 | switch (featureID) { |
198 | case UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT: |
199 | return basicGetUnit() != null; |
200 | case UnitsPackage.UNIT_CARRYING_ELEMENT__UNIT_SPECIFICATION: |
201 | return UNIT_SPECIFICATION_EDEFAULT == null ? unitSpecification != null : !UNIT_SPECIFICATION_EDEFAULT.equals(unitSpecification); |
202 | } |
203 | return super.eIsSet(featureID); |
204 | } |
205 | |
206 | /** |
207 | * <!-- begin-user-doc --> |
208 | * <!-- end-user-doc --> |
209 | * @generated |
210 | */ |
211 | @Override |
212 | public String toString() { |
213 | if (eIsProxy()) return super.toString(); |
214 | |
215 | StringBuffer result = new StringBuffer(super.toString()); |
216 | result.append(" (unitSpecification: "); |
217 | result.append(unitSpecification); |
218 | result.append(')'); |
219 | return result.toString(); |
220 | } |
221 | |
222 | } //UnitCarryingElementImpl |