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