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.UnitMultiplication; |
11 | import de.uka.ipd.sdq.units.UnitsPackage; |
12 | |
13 | import java.util.Collection; |
14 | |
15 | import org.eclipse.emf.common.notify.NotificationChain; |
16 | |
17 | import org.eclipse.emf.common.util.EList; |
18 | |
19 | import org.eclipse.emf.ecore.EClass; |
20 | import org.eclipse.emf.ecore.InternalEObject; |
21 | |
22 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
23 | import org.eclipse.emf.ecore.util.InternalEList; |
24 | |
25 | /** |
26 | * <!-- begin-user-doc --> |
27 | * An implementation of the model object '<em><b>Unit Multiplication</b></em>'. |
28 | * <!-- end-user-doc --> |
29 | * <p> |
30 | * The following features are implemented: |
31 | * <ul> |
32 | * <li>{@link de.uka.ipd.sdq.units.impl.UnitMultiplicationImpl#getUnits <em>Units</em>}</li> |
33 | * </ul> |
34 | * </p> |
35 | * |
36 | * @generated |
37 | */ |
38 | public class UnitMultiplicationImpl extends UnitImpl implements UnitMultiplication { |
39 | /** |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
45 | /** |
46 | * The cached value of the '{@link #getUnits() <em>Units</em>}' containment reference list. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getUnits() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected EList<Unit> units; |
54 | |
55 | /** |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | protected UnitMultiplicationImpl() { |
61 | super(); |
62 | } |
63 | |
64 | /** |
65 | * <!-- begin-user-doc --> |
66 | * <!-- end-user-doc --> |
67 | * @generated |
68 | */ |
69 | @Override |
70 | protected EClass eStaticClass() { |
71 | return UnitsPackage.Literals.UNIT_MULTIPLICATION; |
72 | } |
73 | |
74 | /** |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @generated |
78 | */ |
79 | public EList<Unit> getUnits() { |
80 | if (units == null) { |
81 | units = new EObjectContainmentEList<Unit>(Unit.class, this, UnitsPackage.UNIT_MULTIPLICATION__UNITS); |
82 | } |
83 | return units; |
84 | } |
85 | |
86 | /** |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | @Override |
92 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
93 | switch (featureID) { |
94 | case UnitsPackage.UNIT_MULTIPLICATION__UNITS: |
95 | return ((InternalEList<?>)getUnits()).basicRemove(otherEnd, msgs); |
96 | } |
97 | return super.eInverseRemove(otherEnd, featureID, msgs); |
98 | } |
99 | |
100 | /** |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | @Override |
106 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
107 | switch (featureID) { |
108 | case UnitsPackage.UNIT_MULTIPLICATION__UNITS: |
109 | return getUnits(); |
110 | } |
111 | return super.eGet(featureID, resolve, coreType); |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | @SuppressWarnings("unchecked") |
120 | @Override |
121 | public void eSet(int featureID, Object newValue) { |
122 | switch (featureID) { |
123 | case UnitsPackage.UNIT_MULTIPLICATION__UNITS: |
124 | getUnits().clear(); |
125 | getUnits().addAll((Collection<? extends Unit>)newValue); |
126 | return; |
127 | } |
128 | super.eSet(featureID, newValue); |
129 | } |
130 | |
131 | /** |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | @Override |
137 | public void eUnset(int featureID) { |
138 | switch (featureID) { |
139 | case UnitsPackage.UNIT_MULTIPLICATION__UNITS: |
140 | getUnits().clear(); |
141 | return; |
142 | } |
143 | super.eUnset(featureID); |
144 | } |
145 | |
146 | /** |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | public boolean eIsSet(int featureID) { |
153 | switch (featureID) { |
154 | case UnitsPackage.UNIT_MULTIPLICATION__UNITS: |
155 | return units != null && !units.isEmpty(); |
156 | } |
157 | return super.eIsSet(featureID); |
158 | } |
159 | |
160 | } //UnitMultiplicationImpl |