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