1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.repository.impl; |
7 | |
8 | import org.eclipse.emf.common.notify.Notification; |
9 | import org.eclipse.emf.ecore.EClass; |
10 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
11 | |
12 | import de.uka.ipd.sdq.pcm.repository.PrimitiveDataType; |
13 | import de.uka.ipd.sdq.pcm.repository.PrimitiveTypeEnum; |
14 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
15 | |
16 | /** |
17 | * <!-- begin-user-doc --> |
18 | * An implementation of the model object '<em><b>Primitive Data Type</b></em>'. |
19 | * <!-- end-user-doc --> |
20 | * <p> |
21 | * The following features are implemented: |
22 | * <ul> |
23 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.PrimitiveDataTypeImpl#getType <em>Type</em>}</li> |
24 | * </ul> |
25 | * </p> |
26 | * |
27 | * @generated |
28 | */ |
29 | public class PrimitiveDataTypeImpl extends DataTypeImpl implements PrimitiveDataType { |
30 | /** |
31 | * <!-- begin-user-doc --> |
32 | * <!-- end-user-doc --> |
33 | * @generated |
34 | */ |
35 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
36 | |
37 | /** |
38 | * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @see #getType() |
42 | * @generated |
43 | * @ordered |
44 | */ |
45 | protected static final PrimitiveTypeEnum TYPE_EDEFAULT = PrimitiveTypeEnum.INT; |
46 | |
47 | /** |
48 | * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @see #getType() |
52 | * @generated |
53 | * @ordered |
54 | */ |
55 | protected PrimitiveTypeEnum type = TYPE_EDEFAULT; |
56 | |
57 | /** |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | protected PrimitiveDataTypeImpl() { |
63 | super(); |
64 | } |
65 | |
66 | /** |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @generated |
70 | */ |
71 | @Override |
72 | protected EClass eStaticClass() { |
73 | return RepositoryPackage.Literals.PRIMITIVE_DATA_TYPE; |
74 | } |
75 | |
76 | /** |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | public PrimitiveTypeEnum getType() { |
82 | return type; |
83 | } |
84 | |
85 | /** |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | public void setType(PrimitiveTypeEnum newType) { |
91 | PrimitiveTypeEnum oldType = type; |
92 | type = newType == null ? TYPE_EDEFAULT : newType; |
93 | if (eNotificationRequired()) |
94 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.PRIMITIVE_DATA_TYPE__TYPE, oldType, type)); |
95 | } |
96 | |
97 | /** |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | @Override |
103 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
104 | switch (featureID) { |
105 | case RepositoryPackage.PRIMITIVE_DATA_TYPE__TYPE: |
106 | return getType(); |
107 | } |
108 | return super.eGet(featureID, resolve, coreType); |
109 | } |
110 | |
111 | /** |
112 | * <!-- begin-user-doc --> |
113 | * <!-- end-user-doc --> |
114 | * @generated |
115 | */ |
116 | @Override |
117 | public void eSet(int featureID, Object newValue) { |
118 | switch (featureID) { |
119 | case RepositoryPackage.PRIMITIVE_DATA_TYPE__TYPE: |
120 | setType((PrimitiveTypeEnum)newValue); |
121 | return; |
122 | } |
123 | super.eSet(featureID, newValue); |
124 | } |
125 | |
126 | /** |
127 | * <!-- begin-user-doc --> |
128 | * <!-- end-user-doc --> |
129 | * @generated |
130 | */ |
131 | @Override |
132 | public void eUnset(int featureID) { |
133 | switch (featureID) { |
134 | case RepositoryPackage.PRIMITIVE_DATA_TYPE__TYPE: |
135 | setType(TYPE_EDEFAULT); |
136 | return; |
137 | } |
138 | super.eUnset(featureID); |
139 | } |
140 | |
141 | /** |
142 | * <!-- begin-user-doc --> |
143 | * <!-- end-user-doc --> |
144 | * @generated |
145 | */ |
146 | @Override |
147 | public boolean eIsSet(int featureID) { |
148 | switch (featureID) { |
149 | case RepositoryPackage.PRIMITIVE_DATA_TYPE__TYPE: |
150 | return type != TYPE_EDEFAULT; |
151 | } |
152 | return super.eIsSet(featureID); |
153 | } |
154 | |
155 | /** |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | @Override |
161 | public String toString() { |
162 | if (eIsProxy()) return super.toString(); |
163 | |
164 | StringBuffer result = new StringBuffer(super.toString()); |
165 | result.append(" (type: "); |
166 | result.append(type); |
167 | result.append(')'); |
168 | return result.toString(); |
169 | } |
170 | |
171 | } //PrimitiveDataTypeImpl |