/**
* Copyright (c) 2011 Object Management Group (SAEM metamodel)
* Copyright (c) 2010-2011 United States Government as represented by the Administrator for The National Aeronautics and Space Administration. All Rights Reserved.
*/
package net.certware.evidence.evidence.impl;
import java.util.Collection;
import net.certware.evidence.evidence.EvidencePackage;
import net.certware.evidence.evidence.HasRoleIn;
import net.certware.evidence.evidence.Organization;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Organization</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.certware.evidence.evidence.impl.OrganizationImpl#getAddress <em>Address</em>}</li>
* <li>{@link net.certware.evidence.evidence.impl.OrganizationImpl#getAffiliation <em>Affiliation</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class OrganizationImpl extends OriginatorImpl implements Organization {
/**
* The default value of the '{@link #getAddress() <em>Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected static final String ADDRESS_EDEFAULT = null;
/**
* The cached value of the '{@link #getAddress() <em>Address</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAddress()
* @generated
* @ordered
*/
protected String address = ADDRESS_EDEFAULT;
/**
* The cached value of the '{@link #getAffiliation() <em>Affiliation</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAffiliation()
* @generated
* @ordered
*/
protected EList<HasRoleIn> affiliation;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected OrganizationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return EvidencePackage.Literals.ORGANIZATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAddress() {
return address;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAddress(String newAddress) {
String oldAddress = address;
address = newAddress;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EvidencePackage.ORGANIZATION__ADDRESS, oldAddress, address));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<HasRoleIn> getAffiliation() {
if (affiliation == null) {
affiliation = new EObjectContainmentEList<HasRoleIn>(HasRoleIn.class, this, EvidencePackage.ORGANIZATION__AFFILIATION);
}
return affiliation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case EvidencePackage.ORGANIZATION__AFFILIATION:
return ((InternalEList<?>)getAffiliation()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case EvidencePackage.ORGANIZATION__ADDRESS:
return getAddress();
case EvidencePackage.ORGANIZATION__AFFILIATION:
return getAffiliation();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case EvidencePackage.ORGANIZATION__ADDRESS:
setAddress((String)newValue);
return;
case EvidencePackage.ORGANIZATION__AFFILIATION:
getAffiliation().clear();
getAffiliation().addAll((Collection<? extends HasRoleIn>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case EvidencePackage.ORGANIZATION__ADDRESS:
setAddress(ADDRESS_EDEFAULT);
return;
case EvidencePackage.ORGANIZATION__AFFILIATION:
getAffiliation().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case EvidencePackage.ORGANIZATION__ADDRESS:
return ADDRESS_EDEFAULT == null ? address != null : !ADDRESS_EDEFAULT.equals(address);
case EvidencePackage.ORGANIZATION__AFFILIATION:
return affiliation != null && !affiliation.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (address: "); //$NON-NLS-1$
result.append(address);
result.append(')');
return result.toString();
}
} //OrganizationImpl