/** * Copyright (c) 2011 committers of YAKINDU and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * Contributors: * committers of YAKINDU - initial API and implementation * */ package org.yakindu.sct.model.sgraph.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.EObjectImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.yakindu.sct.model.sgraph.SGraphPackage; import org.yakindu.sct.model.sgraph.Scope; import org.yakindu.sct.model.sgraph.ScopedElement; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Scoped Element</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.yakindu.sct.model.sgraph.impl.ScopedElementImpl#getScopes <em>Scopes</em>}</li> * <li>{@link org.yakindu.sct.model.sgraph.impl.ScopedElementImpl#getNamespace <em>Namespace</em>}</li> * </ul> * * @generated */ public abstract class ScopedElementImpl extends EObjectImpl implements ScopedElement { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2011 committers of YAKINDU and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\nContributors:\r\ncommitters of YAKINDU - initial API and implementation\r\n"; /** * The cached value of the '{@link #getScopes() <em>Scopes</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getScopes() * @generated * @ordered */ protected EList<Scope> scopes; /** * The default value of the '{@link #getNamespace() <em>Namespace</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getNamespace() * @generated * @ordered */ protected static final String NAMESPACE_EDEFAULT = null; /** * The cached value of the '{@link #getNamespace() <em>Namespace</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getNamespace() * @generated * @ordered */ protected String namespace = NAMESPACE_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ScopedElementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SGraphPackage.Literals.SCOPED_ELEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Scope> getScopes() { if (scopes == null) { scopes = new EObjectContainmentEList.Resolving<Scope>(Scope.class, this, SGraphPackage.SCOPED_ELEMENT__SCOPES); } return scopes; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getNamespace() { return namespace; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setNamespace(String newNamespace) { String oldNamespace = namespace; namespace = newNamespace; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SGraphPackage.SCOPED_ELEMENT__NAMESPACE, oldNamespace, namespace)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SGraphPackage.SCOPED_ELEMENT__SCOPES: return ((InternalEList<?>)getScopes()).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 SGraphPackage.SCOPED_ELEMENT__SCOPES: return getScopes(); case SGraphPackage.SCOPED_ELEMENT__NAMESPACE: return getNamespace(); } 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 SGraphPackage.SCOPED_ELEMENT__SCOPES: getScopes().clear(); getScopes().addAll((Collection<? extends Scope>)newValue); return; case SGraphPackage.SCOPED_ELEMENT__NAMESPACE: setNamespace((String)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SGraphPackage.SCOPED_ELEMENT__SCOPES: getScopes().clear(); return; case SGraphPackage.SCOPED_ELEMENT__NAMESPACE: setNamespace(NAMESPACE_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SGraphPackage.SCOPED_ELEMENT__SCOPES: return scopes != null && !scopes.isEmpty(); case SGraphPackage.SCOPED_ELEMENT__NAMESPACE: return NAMESPACE_EDEFAULT == null ? namespace != null : !NAMESPACE_EDEFAULT.equals(namespace); } 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(" (namespace: "); result.append(namespace); result.append(')'); return result.toString(); } } //ScopedElementImpl