/** */ package de.gebit.integrity.dsl.impl; import de.gebit.integrity.dsl.DslPackage; import de.gebit.integrity.dsl.PackageDefinition; import de.gebit.integrity.dsl.PackageStatement; 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.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Package Definition</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link de.gebit.integrity.dsl.impl.PackageDefinitionImpl#getName <em>Name</em>}</li> * <li>{@link de.gebit.integrity.dsl.impl.PackageDefinitionImpl#getStatements <em>Statements</em>}</li> * </ul> * * @generated */ public class PackageDefinitionImpl extends StatementImpl implements PackageDefinition { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getStatements() <em>Statements</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getStatements() * @generated * @ordered */ protected EList<PackageStatement> statements; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected PackageDefinitionImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DslPackage.Literals.PACKAGE_DEFINITION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.PACKAGE_DEFINITION__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<PackageStatement> getStatements() { if (statements == null) { statements = new EObjectContainmentEList<PackageStatement>(PackageStatement.class, this, DslPackage.PACKAGE_DEFINITION__STATEMENTS); } return statements; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DslPackage.PACKAGE_DEFINITION__STATEMENTS: return ((InternalEList<?>)getStatements()).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 DslPackage.PACKAGE_DEFINITION__NAME: return getName(); case DslPackage.PACKAGE_DEFINITION__STATEMENTS: return getStatements(); } 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 DslPackage.PACKAGE_DEFINITION__NAME: setName((String)newValue); return; case DslPackage.PACKAGE_DEFINITION__STATEMENTS: getStatements().clear(); getStatements().addAll((Collection<? extends PackageStatement>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DslPackage.PACKAGE_DEFINITION__NAME: setName(NAME_EDEFAULT); return; case DslPackage.PACKAGE_DEFINITION__STATEMENTS: getStatements().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case DslPackage.PACKAGE_DEFINITION__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case DslPackage.PACKAGE_DEFINITION__STATEMENTS: return statements != null && !statements.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(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //PackageDefinitionImpl