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

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

Work in progress

File size: 4.9 KB
Line 
1/**
2 * <copyright>
3 * </copyright>
4 *
5 * $Id$
6 */
7package PhysicalQuantities.impl;
8
9import PhysicalQuantities.BaseUnit;
10import PhysicalQuantities.PhysicalQuantitiesPackage;
11import PhysicalQuantities.Quantity;
12import PhysicalQuantities.SystemOfUnits;
13
14import java.util.Collection;
15
16import org.eclipse.emf.common.notify.NotificationChain;
17
18import org.eclipse.emf.common.util.EList;
19
20import org.eclipse.emf.ecore.EClass;
21import org.eclipse.emf.ecore.InternalEObject;
22
23import org.eclipse.emf.ecore.impl.EObjectImpl;
24
25import org.eclipse.emf.ecore.util.EObjectContainmentEList;
26import org.eclipse.emf.ecore.util.InternalEList;
27
28/**
29 * <!-- begin-user-doc -->
30 * An implementation of the model object '<em><b>System Of Units</b></em>'.
31 * <!-- end-user-doc -->
32 * <p>
33 * The following features are implemented:
34 * <ul>
35 *   <li>{@link PhysicalQuantities.impl.SystemOfUnitsImpl#getBaseUnits <em>Base Units</em>}</li>
36 *   <li>{@link PhysicalQuantities.impl.SystemOfUnitsImpl#getQuantities <em>Quantities</em>}</li>
37 * </ul>
38 * </p>
39 *
40 * @generated
41 */
42public class SystemOfUnitsImpl extends EObjectImpl implements SystemOfUnits {
43    /**
44     * The cached value of the '{@link #getBaseUnits() <em>Base Units</em>}' containment reference list.
45     * <!-- begin-user-doc -->
46     * <!-- end-user-doc -->
47     * @see #getBaseUnits()
48     * @generated
49     * @ordered
50     */
51    protected EList<BaseUnit> baseUnits;
52
53    /**
54     * The cached value of the '{@link #getQuantities() <em>Quantities</em>}' containment reference list.
55     * <!-- begin-user-doc -->
56     * <!-- end-user-doc -->
57     * @see #getQuantities()
58     * @generated
59     * @ordered
60     */
61    protected EList<Quantity> quantities;
62
63    /**
64     * <!-- begin-user-doc -->
65     * <!-- end-user-doc -->
66     * @generated
67     */
68    protected SystemOfUnitsImpl() {
69        super();
70    }
71
72    /**
73     * <!-- begin-user-doc -->
74     * <!-- end-user-doc -->
75     * @generated
76     */
77    @Override
78    protected EClass eStaticClass() {
79        return PhysicalQuantitiesPackage.Literals.SYSTEM_OF_UNITS;
80    }
81
82    /**
83     * <!-- begin-user-doc -->
84     * <!-- end-user-doc -->
85     * @generated
86     */
87    public EList<BaseUnit> getBaseUnits() {
88        if (baseUnits == null) {
89            baseUnits = new EObjectContainmentEList<BaseUnit>(BaseUnit.class, this, PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__BASE_UNITS);
90        }
91        return baseUnits;
92    }
93
94    /**
95     * <!-- begin-user-doc -->
96     * <!-- end-user-doc -->
97     * @generated
98     */
99    public EList<Quantity> getQuantities() {
100        if (quantities == null) {
101            quantities = new EObjectContainmentEList<Quantity>(Quantity.class, this, PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__QUANTITIES);
102        }
103        return quantities;
104    }
105
106    /**
107     * <!-- begin-user-doc -->
108     * <!-- end-user-doc -->
109     * @generated
110     */
111    @Override
112    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
113        switch (featureID) {
114            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__BASE_UNITS:
115                return ((InternalEList<?>)getBaseUnits()).basicRemove(otherEnd, msgs);
116            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__QUANTITIES:
117                return ((InternalEList<?>)getQuantities()).basicRemove(otherEnd, msgs);
118        }
119        return super.eInverseRemove(otherEnd, featureID, msgs);
120    }
121
122    /**
123     * <!-- begin-user-doc -->
124     * <!-- end-user-doc -->
125     * @generated
126     */
127    @Override
128    public Object eGet(int featureID, boolean resolve, boolean coreType) {
129        switch (featureID) {
130            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__BASE_UNITS:
131                return getBaseUnits();
132            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__QUANTITIES:
133                return getQuantities();
134        }
135        return super.eGet(featureID, resolve, coreType);
136    }
137
138    /**
139     * <!-- begin-user-doc -->
140     * <!-- end-user-doc -->
141     * @generated
142     */
143    @SuppressWarnings("unchecked")
144    @Override
145    public void eSet(int featureID, Object newValue) {
146        switch (featureID) {
147            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__BASE_UNITS:
148                getBaseUnits().clear();
149                getBaseUnits().addAll((Collection<? extends BaseUnit>)newValue);
150                return;
151            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__QUANTITIES:
152                getQuantities().clear();
153                getQuantities().addAll((Collection<? extends Quantity>)newValue);
154                return;
155        }
156        super.eSet(featureID, newValue);
157    }
158
159    /**
160     * <!-- begin-user-doc -->
161     * <!-- end-user-doc -->
162     * @generated
163     */
164    @Override
165    public void eUnset(int featureID) {
166        switch (featureID) {
167            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__BASE_UNITS:
168                getBaseUnits().clear();
169                return;
170            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__QUANTITIES:
171                getQuantities().clear();
172                return;
173        }
174        super.eUnset(featureID);
175    }
176
177    /**
178     * <!-- begin-user-doc -->
179     * <!-- end-user-doc -->
180     * @generated
181     */
182    @Override
183    public boolean eIsSet(int featureID) {
184        switch (featureID) {
185            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__BASE_UNITS:
186                return baseUnits != null && !baseUnits.isEmpty();
187            case PhysicalQuantitiesPackage.SYSTEM_OF_UNITS__QUANTITIES:
188                return quantities != null && !quantities.isEmpty();
189        }
190        return super.eIsSet(featureID);
191    }
192
193} //SystemOfUnitsImpl
Note: See TracBrowser for help on using the repository browser.