source: branches/xtext-MDT/org.modelica.emf.units/src/PhysicalQuantities/impl/ProductUnitImpl.java @ 552

Last change on this file since 552 was 552, checked in by nasko, 15 years ago

Work in progress

File size: 4.5 KB
Line 
1/**
2 * <copyright>
3 * </copyright>
4 *
5 * $Id$
6 */
7package PhysicalQuantities.impl;
8
9import PhysicalQuantities.PhysicalQuantitiesPackage;
10import PhysicalQuantities.ProductUnit;
11import PhysicalQuantities.ProductUnitElement;
12
13import org.eclipse.emf.common.notify.Notification;
14import org.eclipse.emf.common.notify.NotificationChain;
15
16import org.eclipse.emf.ecore.EClass;
17import org.eclipse.emf.ecore.InternalEObject;
18
19import 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 */
34public 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
Note: See TracBrowser for help on using the repository browser.