blob: 97d80bf8aad5653e87e12744fc264a9f814aa3a9 [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2009, 2019 Mia-Software and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
*
* Fabien Giquel (Mia-Software) - initial API and implementation
* Gregoire DUPE (Mia-Software) - initial API and implementation
* *******************************************************************************
*
* $Id$
*/
package org.eclipse.modisco.java.nousages.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.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.modisco.java.ImportDeclaration;
import org.eclipse.modisco.java.NamedElement;
import org.eclipse.modisco.java.nousages.meta.JavaPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '
* <em><b>Named Element</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>
* {@link org.eclipse.modisco.java.nousages.impl.NamedElementImpl#getName
* <em>Name</em>}</li>
* <li>
* {@link org.eclipse.modisco.java.nousages.impl.NamedElementImpl#isProxy
* <em>Proxy</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class NamedElementImpl extends ASTNodeImpl implements
NamedElement {
/**
* 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 default value of the '{@link #isProxy() <em>Proxy</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #isProxy()
* @generated
* @ordered
*/
protected static final boolean PROXY_EDEFAULT = false;
/**
* The cached value of the '{@link #isProxy() <em>Proxy</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #isProxy()
* @generated
* @ordered
*/
protected boolean proxy = PROXY_EDEFAULT;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected NamedElementImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return JavaPackage.eINSTANCE.getNamedElement();
}
/**
* <!-- 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,
JavaPackage.NAMED_ELEMENT__NAME, oldName, name));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public boolean isProxy() {
return proxy;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void setProxy(boolean newProxy) {
boolean oldProxy = proxy;
proxy = newProxy;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
JavaPackage.NAMED_ELEMENT__PROXY, oldProxy, proxy));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case JavaPackage.NAMED_ELEMENT__NAME:
return getName();
case JavaPackage.NAMED_ELEMENT__PROXY:
return isProxy();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case JavaPackage.NAMED_ELEMENT__NAME:
setName((String) newValue);
return;
case JavaPackage.NAMED_ELEMENT__PROXY:
setProxy((Boolean) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case JavaPackage.NAMED_ELEMENT__NAME:
setName(NAME_EDEFAULT);
return;
case JavaPackage.NAMED_ELEMENT__PROXY:
setProxy(PROXY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JavaPackage.NAMED_ELEMENT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT
.equals(name);
case JavaPackage.NAMED_ELEMENT__PROXY:
return proxy != PROXY_EDEFAULT;
}
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: "); //$NON-NLS-1$
result.append(name);
result.append(", proxy: "); //$NON-NLS-1$
result.append(proxy);
result.append(')');
return result.toString();
}
} // NamedElementImpl