/**
*/
package socialnetwork.impl;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import socialnetwork.Person;
import socialnetwork.SocialNetwork;
import socialnetwork.SocialnetworkPackage;
/**
*
* An implementation of the model object 'Social Network'.
*
*
* The following features are implemented:
*
*
* - {@link socialnetwork.impl.SocialNetworkImpl#getName Name}
* - {@link socialnetwork.impl.SocialNetworkImpl#getPersons Persons}
*
*
* @generated
*/
public class SocialNetworkImpl extends MinimalEObjectImpl.Container implements SocialNetwork {
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = "SocialNetwork";
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getPersons() Persons}' containment reference list.
*
*
* @see #getPersons()
* @generated
* @ordered
*/
protected EList persons;
/**
*
*
* @generated
*/
protected SocialNetworkImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SocialnetworkPackage.Literals.SOCIAL_NETWORK;
}
/**
*
*
* @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, SocialnetworkPackage.SOCIAL_NETWORK__NAME, oldName,
name));
}
/**
*
*
* @generated
*/
@Override
public EList getPersons() {
if (persons == null) {
persons = new EObjectContainmentEList(Person.class, this,
SocialnetworkPackage.SOCIAL_NETWORK__PERSONS);
}
return persons;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SocialnetworkPackage.SOCIAL_NETWORK__PERSONS:
return ((InternalEList>) getPersons()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SocialnetworkPackage.SOCIAL_NETWORK__NAME:
return getName();
case SocialnetworkPackage.SOCIAL_NETWORK__PERSONS:
return getPersons();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SocialnetworkPackage.SOCIAL_NETWORK__NAME:
setName((String) newValue);
return;
case SocialnetworkPackage.SOCIAL_NETWORK__PERSONS:
getPersons().clear();
getPersons().addAll((Collection extends Person>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SocialnetworkPackage.SOCIAL_NETWORK__NAME:
setName(NAME_EDEFAULT);
return;
case SocialnetworkPackage.SOCIAL_NETWORK__PERSONS:
getPersons().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SocialnetworkPackage.SOCIAL_NETWORK__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case SocialnetworkPackage.SOCIAL_NETWORK__PERSONS:
return persons != null && !persons.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(')');
return result.toString();
}
} //SocialNetworkImpl