1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.identifier.impl; |
8 | |
9 | import java.util.Map; |
10 | |
11 | import org.eclipse.emf.common.notify.Notification; |
12 | import org.eclipse.emf.common.util.BasicDiagnostic; |
13 | import org.eclipse.emf.common.util.Diagnostic; |
14 | import org.eclipse.emf.common.util.DiagnosticChain; |
15 | import org.eclipse.emf.ecore.EClass; |
16 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
17 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
18 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
19 | import org.eclipse.emf.ecore.util.EObjectValidator; |
20 | import org.eclipse.emf.ecore.util.EcoreUtil; |
21 | |
22 | import de.uka.ipd.sdq.identifier.Identifier; |
23 | import de.uka.ipd.sdq.identifier.IdentifierPackage; |
24 | import de.uka.ipd.sdq.identifier.util.IdentifierValidator; |
25 | |
26 | /** |
27 | * <!-- begin-user-doc --> |
28 | * An implementation of the model object '<em><b>Identifier</b></em>'. |
29 | * <!-- end-user-doc --> |
30 | * <p> |
31 | * The following features are implemented: |
32 | * <ul> |
33 | * <li>{@link de.uka.ipd.sdq.identifier.impl.IdentifierImpl#getId <em>Id</em>}</li> |
34 | * </ul> |
35 | * </p> |
36 | * |
37 | * @generated |
38 | */ |
39 | public abstract class IdentifierImpl extends EObjectImpl implements Identifier { |
40 | /** |
41 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> |
43 | * @generated |
44 | */ |
45 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
46 | |
47 | /** |
48 | * The default value of the '{@link #getId() <em>Id</em>}' attribute. |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @see #getId() |
52 | * @generated |
53 | * @ordered |
54 | */ |
55 | protected static final String ID_EDEFAULT = null; |
56 | |
57 | /** |
58 | * The cached value of the '{@link #getId() <em>Id</em>}' attribute. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @see #getId() |
62 | * @generated |
63 | * @ordered |
64 | */ |
65 | protected String id = ID_EDEFAULT; |
66 | |
67 | /** |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @generated not |
71 | */ |
72 | protected IdentifierImpl() { |
73 | super(); |
74 | setId(EcoreUtil.generateUUID()); |
75 | } |
76 | |
77 | /** |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | @Override |
83 | protected EClass eStaticClass() { |
84 | return IdentifierPackage.Literals.IDENTIFIER; |
85 | } |
86 | |
87 | /** |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | public String getId() { |
93 | return id; |
94 | } |
95 | |
96 | /** |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | public void setId(String newId) { |
102 | String oldId = id; |
103 | id = newId; |
104 | if (eNotificationRequired()) |
105 | eNotify(new ENotificationImpl(this, Notification.SET, IdentifierPackage.IDENTIFIER__ID, oldId, id)); |
106 | } |
107 | |
108 | /** |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | public boolean idHasToBeUnique(DiagnosticChain diagnostics, Map<Object, Object> context) { |
114 | // TODO: implement this method |
115 | // -> specify the condition that violates the invariant |
116 | // -> verify the details of the diagnostic, including severity and message |
117 | // Ensure that you remove @generated or mark it @generated NOT |
118 | if (false) { |
119 | if (diagnostics != null) { |
120 | diagnostics.add |
121 | (new BasicDiagnostic |
122 | (Diagnostic.ERROR, |
123 | IdentifierValidator.DIAGNOSTIC_SOURCE, |
124 | IdentifierValidator.IDENTIFIER__ID_HAS_TO_BE_UNIQUE, |
125 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "idHasToBeUnique", EObjectValidator.getObjectLabel(this, context) }), |
126 | new Object [] { this })); |
127 | } |
128 | return false; |
129 | } |
130 | return true; |
131 | } |
132 | |
133 | /** |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
140 | switch (featureID) { |
141 | case IdentifierPackage.IDENTIFIER__ID: |
142 | return getId(); |
143 | } |
144 | return super.eGet(featureID, resolve, coreType); |
145 | } |
146 | |
147 | /** |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | @Override |
153 | public void eSet(int featureID, Object newValue) { |
154 | switch (featureID) { |
155 | case IdentifierPackage.IDENTIFIER__ID: |
156 | setId((String)newValue); |
157 | return; |
158 | } |
159 | super.eSet(featureID, newValue); |
160 | } |
161 | |
162 | /** |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | @Override |
168 | public void eUnset(int featureID) { |
169 | switch (featureID) { |
170 | case IdentifierPackage.IDENTIFIER__ID: |
171 | setId(ID_EDEFAULT); |
172 | return; |
173 | } |
174 | super.eUnset(featureID); |
175 | } |
176 | |
177 | /** |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | @Override |
183 | public boolean eIsSet(int featureID) { |
184 | switch (featureID) { |
185 | case IdentifierPackage.IDENTIFIER__ID: |
186 | return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); |
187 | } |
188 | return super.eIsSet(featureID); |
189 | } |
190 | |
191 | /** |
192 | * <!-- begin-user-doc --> |
193 | * <!-- end-user-doc --> |
194 | * @generated |
195 | */ |
196 | @Override |
197 | public String toString() { |
198 | if (eIsProxy()) return super.toString(); |
199 | |
200 | StringBuffer result = new StringBuffer(super.toString()); |
201 | result.append(" (id: "); |
202 | result.append(id); |
203 | result.append(')'); |
204 | return result.toString(); |
205 | } |
206 | |
207 | } //IdentifierImpl |