/** */ package familytree.impl; import familytree.FamilytreePackage; import familytree.Member; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; /** * * An implementation of the model object 'Member'. * *

* The following features are implemented: *

* * * @generated */ public class MemberImpl extends MinimalEObjectImpl.Container implements Member { /** * The default value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The default value of the '{@link #getAge() Age}' attribute. * * * @see #getAge() * @generated * @ordered */ protected static final int AGE_EDEFAULT = 0; /** * The cached value of the '{@link #getAge() Age}' attribute. * * * @see #getAge() * @generated * @ordered */ protected int age = AGE_EDEFAULT; /** * The cached value of the '{@link #getChildren() Children}' reference list. * * * @see #getChildren() * @generated * @ordered */ protected EList children; /** * The cached value of the '{@link #getParents() Parents}' reference list. * * * @see #getParents() * @generated * @ordered */ protected EList parents; /** * * * @generated */ protected MemberImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return FamilytreePackage.Literals.MEMBER; } /** * * * @generated */ @Override public String getName() { return name; } /** * * * @generated */ @Override public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FamilytreePackage.MEMBER__NAME, oldName, name)); } /** * * * @generated */ @Override public int getAge() { return age; } /** * * * @generated */ @Override public void setAge(int newAge) { int oldAge = age; age = newAge; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FamilytreePackage.MEMBER__AGE, oldAge, age)); } /** * * * @generated */ @Override public EList getChildren() { if (children == null) { children = new EObjectWithInverseResolvingEList.ManyInverse(Member.class, this, FamilytreePackage.MEMBER__CHILDREN, FamilytreePackage.MEMBER__PARENTS); } return children; } /** * * * @generated */ @Override public EList getParents() { if (parents == null) { parents = new EObjectWithInverseResolvingEList.ManyInverse(Member.class, this, FamilytreePackage.MEMBER__PARENTS, FamilytreePackage.MEMBER__CHILDREN); } return parents; } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case FamilytreePackage.MEMBER__CHILDREN: return ((InternalEList)(InternalEList)getChildren()).basicAdd(otherEnd, msgs); case FamilytreePackage.MEMBER__PARENTS: return ((InternalEList)(InternalEList)getParents()).basicAdd(otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case FamilytreePackage.MEMBER__CHILDREN: return ((InternalEList)getChildren()).basicRemove(otherEnd, msgs); case FamilytreePackage.MEMBER__PARENTS: return ((InternalEList)getParents()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case FamilytreePackage.MEMBER__NAME: return getName(); case FamilytreePackage.MEMBER__AGE: return getAge(); case FamilytreePackage.MEMBER__CHILDREN: return getChildren(); case FamilytreePackage.MEMBER__PARENTS: return getParents(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case FamilytreePackage.MEMBER__NAME: setName((String)newValue); return; case FamilytreePackage.MEMBER__AGE: setAge((Integer)newValue); return; case FamilytreePackage.MEMBER__CHILDREN: getChildren().clear(); getChildren().addAll((Collection)newValue); return; case FamilytreePackage.MEMBER__PARENTS: getParents().clear(); getParents().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case FamilytreePackage.MEMBER__NAME: setName(NAME_EDEFAULT); return; case FamilytreePackage.MEMBER__AGE: setAge(AGE_EDEFAULT); return; case FamilytreePackage.MEMBER__CHILDREN: getChildren().clear(); return; case FamilytreePackage.MEMBER__PARENTS: getParents().clear(); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case FamilytreePackage.MEMBER__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case FamilytreePackage.MEMBER__AGE: return age != AGE_EDEFAULT; case FamilytreePackage.MEMBER__CHILDREN: return children != null && !children.isEmpty(); case FamilytreePackage.MEMBER__PARENTS: return parents != null && !parents.isEmpty(); } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (name: "); result.append(name); result.append(", age: "); result.append(age); result.append(')'); return result.toString(); } } //MemberImpl