001    /**
002     * <copyright>
003     * </copyright>
004     *
005     * $Id$
006     */
007    package com.hammurapi.party.impl;
008    
009    import com.hammurapi.party.Identity;
010    import com.hammurapi.party.PartyPackage;
011    import com.hammurapi.party.Tag;
012    
013    import java.util.Collection;
014    
015    import org.eclipse.emf.common.notify.Notification;
016    import org.eclipse.emf.common.notify.NotificationChain;
017    
018    import org.eclipse.emf.common.util.EList;
019    
020    import org.eclipse.emf.ecore.EClass;
021    import org.eclipse.emf.ecore.InternalEObject;
022    
023    import org.eclipse.emf.ecore.impl.ENotificationImpl;
024    import org.eclipse.emf.ecore.impl.EObjectImpl;
025    
026    import org.eclipse.emf.ecore.util.EObjectContainmentEList;
027    import org.eclipse.emf.ecore.util.InternalEList;
028    
029    /**
030     * <!-- begin-user-doc -->
031     * An implementation of the model object '<em><b>Identity</b></em>'.
032     * <!-- end-user-doc -->
033     * <p>
034     * The following features are implemented:
035     * <ul>
036     *   <li>{@link com.hammurapi.party.impl.IdentityImpl#getType <em>Type</em>}</li>
037     *   <li>{@link com.hammurapi.party.impl.IdentityImpl#getValue <em>Value</em>}</li>
038     *   <li>{@link com.hammurapi.party.impl.IdentityImpl#getComment <em>Comment</em>}</li>
039     * </ul>
040     * </p>
041     *
042     * @generated
043     */
044    public class IdentityImpl extends EObjectImpl implements Identity {
045            /**
046             * The default value of the '{@link #getType() <em>Type</em>}' attribute.
047             * <!-- begin-user-doc -->
048             * <!-- end-user-doc -->
049             * @see #getType()
050             * @generated
051             * @ordered
052             */
053            protected static final String TYPE_EDEFAULT = null;
054    
055            /**
056             * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
057             * <!-- begin-user-doc -->
058             * <!-- end-user-doc -->
059             * @see #getType()
060             * @generated
061             * @ordered
062             */
063            protected String type = TYPE_EDEFAULT;
064    
065            /**
066             * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
067             * <!-- begin-user-doc -->
068             * <!-- end-user-doc -->
069             * @see #getValue()
070             * @generated
071             * @ordered
072             */
073            protected static final String VALUE_EDEFAULT = null;
074    
075            /**
076             * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
077             * <!-- begin-user-doc -->
078             * <!-- end-user-doc -->
079             * @see #getValue()
080             * @generated
081             * @ordered
082             */
083            protected String value = VALUE_EDEFAULT;
084    
085            /**
086             * The default value of the '{@link #getComment() <em>Comment</em>}' attribute.
087             * <!-- begin-user-doc -->
088             * <!-- end-user-doc -->
089             * @see #getComment()
090             * @generated
091             * @ordered
092             */
093            protected static final String COMMENT_EDEFAULT = null;
094    
095            /**
096             * The cached value of the '{@link #getComment() <em>Comment</em>}' attribute.
097             * <!-- begin-user-doc -->
098             * <!-- end-user-doc -->
099             * @see #getComment()
100             * @generated
101             * @ordered
102             */
103            protected String comment = COMMENT_EDEFAULT;
104    
105            /**
106             * <!-- begin-user-doc -->
107             * <!-- end-user-doc -->
108             * @generated
109             */
110            protected IdentityImpl() {
111                    super();
112            }
113    
114            /**
115             * <!-- begin-user-doc -->
116             * <!-- end-user-doc -->
117             * @generated
118             */
119            @Override
120            protected EClass eStaticClass() {
121                    return PartyPackage.Literals.IDENTITY;
122            }
123    
124            /**
125             * <!-- begin-user-doc -->
126             * <!-- end-user-doc -->
127             * @generated
128             */
129            public String getComment() {
130                    return comment;
131            }
132    
133            /**
134             * <!-- begin-user-doc -->
135             * <!-- end-user-doc -->
136             * @generated
137             */
138            public void setComment(String newComment) {
139                    String oldComment = comment;
140                    comment = newComment;
141                    if (eNotificationRequired())
142                            eNotify(new ENotificationImpl(this, Notification.SET, PartyPackage.IDENTITY__COMMENT, oldComment, comment));
143            }
144    
145            /**
146             * <!-- begin-user-doc -->
147             * <!-- end-user-doc -->
148             * @generated
149             */
150            public String getType() {
151                    return type;
152            }
153    
154            /**
155             * <!-- begin-user-doc -->
156             * <!-- end-user-doc -->
157             * @generated
158             */
159            public void setType(String newType) {
160                    String oldType = type;
161                    type = newType;
162                    if (eNotificationRequired())
163                            eNotify(new ENotificationImpl(this, Notification.SET, PartyPackage.IDENTITY__TYPE, oldType, type));
164            }
165    
166            /**
167             * <!-- begin-user-doc -->
168             * <!-- end-user-doc -->
169             * @generated
170             */
171            public String getValue() {
172                    return value;
173            }
174    
175            /**
176             * <!-- begin-user-doc -->
177             * <!-- end-user-doc -->
178             * @generated
179             */
180            public void setValue(String newValue) {
181                    String oldValue = value;
182                    value = newValue;
183                    if (eNotificationRequired())
184                            eNotify(new ENotificationImpl(this, Notification.SET, PartyPackage.IDENTITY__VALUE, oldValue, value));
185            }
186    
187            /**
188             * <!-- begin-user-doc -->
189             * <!-- end-user-doc -->
190             * @generated
191             */
192            @Override
193            public Object eGet(int featureID, boolean resolve, boolean coreType) {
194                    switch (featureID) {
195                            case PartyPackage.IDENTITY__TYPE:
196                                    return getType();
197                            case PartyPackage.IDENTITY__VALUE:
198                                    return getValue();
199                            case PartyPackage.IDENTITY__COMMENT:
200                                    return getComment();
201                    }
202                    return super.eGet(featureID, resolve, coreType);
203            }
204    
205            /**
206             * <!-- begin-user-doc -->
207             * <!-- end-user-doc -->
208             * @generated
209             */
210            @SuppressWarnings("unchecked")
211            @Override
212            public void eSet(int featureID, Object newValue) {
213                    switch (featureID) {
214                            case PartyPackage.IDENTITY__TYPE:
215                                    setType((String)newValue);
216                                    return;
217                            case PartyPackage.IDENTITY__VALUE:
218                                    setValue((String)newValue);
219                                    return;
220                            case PartyPackage.IDENTITY__COMMENT:
221                                    setComment((String)newValue);
222                                    return;
223                    }
224                    super.eSet(featureID, newValue);
225            }
226    
227            /**
228             * <!-- begin-user-doc -->
229             * <!-- end-user-doc -->
230             * @generated
231             */
232            @Override
233            public void eUnset(int featureID) {
234                    switch (featureID) {
235                            case PartyPackage.IDENTITY__TYPE:
236                                    setType(TYPE_EDEFAULT);
237                                    return;
238                            case PartyPackage.IDENTITY__VALUE:
239                                    setValue(VALUE_EDEFAULT);
240                                    return;
241                            case PartyPackage.IDENTITY__COMMENT:
242                                    setComment(COMMENT_EDEFAULT);
243                                    return;
244                    }
245                    super.eUnset(featureID);
246            }
247    
248            /**
249             * <!-- begin-user-doc -->
250             * <!-- end-user-doc -->
251             * @generated
252             */
253            @Override
254            public boolean eIsSet(int featureID) {
255                    switch (featureID) {
256                            case PartyPackage.IDENTITY__TYPE:
257                                    return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
258                            case PartyPackage.IDENTITY__VALUE:
259                                    return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
260                            case PartyPackage.IDENTITY__COMMENT:
261                                    return COMMENT_EDEFAULT == null ? comment != null : !COMMENT_EDEFAULT.equals(comment);
262                    }
263                    return super.eIsSet(featureID);
264            }
265    
266            /**
267             * <!-- begin-user-doc -->
268             * <!-- end-user-doc -->
269             * @generated
270             */
271            @Override
272            public String toString() {
273                    if (eIsProxy()) return super.toString();
274    
275                    StringBuffer result = new StringBuffer(super.toString());
276                    result.append(" (type: ");
277                    result.append(type);
278                    result.append(", value: ");
279                    result.append(value);
280                    result.append(", comment: ");
281                    result.append(comment);
282                    result.append(')');
283                    return result.toString();
284            }
285    
286    } //IdentityImpl