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