1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EssentialOCL.impl; |
8 | |
9 | import EMOF.Type; |
10 | |
11 | import EMOF.impl.DataTypeImpl; |
12 | |
13 | import EssentialOCL.CollectionType; |
14 | import EssentialOCL.EssentialOCLPackage; |
15 | |
16 | import org.eclipse.emf.common.notify.Notification; |
17 | |
18 | import org.eclipse.emf.ecore.EClass; |
19 | import org.eclipse.emf.ecore.InternalEObject; |
20 | |
21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
22 | |
23 | /** |
24 | * <!-- begin-user-doc --> |
25 | * An implementation of the model object '<em><b>Collection Type</b></em>'. |
26 | * <!-- end-user-doc --> |
27 | * <p> |
28 | * The following features are implemented: |
29 | * <ul> |
30 | * <li>{@link EssentialOCL.impl.CollectionTypeImpl#getElementType <em>Element Type</em>}</li> |
31 | * </ul> |
32 | * </p> |
33 | * |
34 | * @generated |
35 | */ |
36 | public class CollectionTypeImpl extends DataTypeImpl implements CollectionType { |
37 | /** |
38 | * The cached value of the '{@link #getElementType() <em>Element Type</em>}' reference. |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @see #getElementType() |
42 | * @generated |
43 | * @ordered |
44 | */ |
45 | protected Type elementType; |
46 | |
47 | /** |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | protected CollectionTypeImpl() { |
53 | super(); |
54 | } |
55 | |
56 | /** |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | @Override |
62 | protected EClass eStaticClass() { |
63 | return EssentialOCLPackage.Literals.COLLECTION_TYPE; |
64 | } |
65 | |
66 | /** |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @generated |
70 | */ |
71 | public Type getElementType() { |
72 | if (elementType != null && elementType.eIsProxy()) { |
73 | InternalEObject oldElementType = (InternalEObject)elementType; |
74 | elementType = (Type)eResolveProxy(oldElementType); |
75 | if (elementType != oldElementType) { |
76 | if (eNotificationRequired()) |
77 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, EssentialOCLPackage.COLLECTION_TYPE__ELEMENT_TYPE, oldElementType, elementType)); |
78 | } |
79 | } |
80 | return elementType; |
81 | } |
82 | |
83 | /** |
84 | * <!-- begin-user-doc --> |
85 | * <!-- end-user-doc --> |
86 | * @generated |
87 | */ |
88 | public Type basicGetElementType() { |
89 | return elementType; |
90 | } |
91 | |
92 | /** |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | public void setElementType(Type newElementType) { |
98 | Type oldElementType = elementType; |
99 | elementType = newElementType; |
100 | if (eNotificationRequired()) |
101 | eNotify(new ENotificationImpl(this, Notification.SET, EssentialOCLPackage.COLLECTION_TYPE__ELEMENT_TYPE, oldElementType, elementType)); |
102 | } |
103 | |
104 | /** |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | @Override |
110 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
111 | switch (featureID) { |
112 | case EssentialOCLPackage.COLLECTION_TYPE__ELEMENT_TYPE: |
113 | if (resolve) return getElementType(); |
114 | return basicGetElementType(); |
115 | } |
116 | return super.eGet(featureID, resolve, coreType); |
117 | } |
118 | |
119 | /** |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | public void eSet(int featureID, Object newValue) { |
126 | switch (featureID) { |
127 | case EssentialOCLPackage.COLLECTION_TYPE__ELEMENT_TYPE: |
128 | setElementType((Type)newValue); |
129 | return; |
130 | } |
131 | super.eSet(featureID, newValue); |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | public void eUnset(int featureID) { |
141 | switch (featureID) { |
142 | case EssentialOCLPackage.COLLECTION_TYPE__ELEMENT_TYPE: |
143 | setElementType((Type)null); |
144 | return; |
145 | } |
146 | super.eUnset(featureID); |
147 | } |
148 | |
149 | /** |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | public boolean eIsSet(int featureID) { |
156 | switch (featureID) { |
157 | case EssentialOCLPackage.COLLECTION_TYPE__ELEMENT_TYPE: |
158 | return elementType != null; |
159 | } |
160 | return super.eIsSet(featureID); |
161 | } |
162 | |
163 | } //CollectionTypeImpl |