/** | |
* ******************************************************************************* | |
* Copyright (c) 2008 Hatha Systems. | |
* 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: | |
* Nikolai Mansourov (Hatha Systems) - initial API and implementation | |
* ******************************************************************************* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.gmt.modisco.omg.kdm.core.impl; | |
import java.util.Collection; | |
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.EObjectImpl; | |
import org.eclipse.emf.ecore.util.EObjectContainmentEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
import org.eclipse.gmt.modisco.omg.kdm.core.CorePackage; | |
import org.eclipse.gmt.modisco.omg.kdm.core.Element; | |
import org.eclipse.gmt.modisco.omg.kdm.kdm.Annotation; | |
import org.eclipse.gmt.modisco.omg.kdm.kdm.Attribute; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Element</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.core.impl.ElementImpl#getAttribute <em>Attribute</em>}</li> | |
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.core.impl.ElementImpl#getAnnotation <em>Annotation</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public abstract class ElementImpl extends EObjectImpl implements Element { | |
/** | |
* The cached value of the '{@link #getAttribute() <em>Attribute</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getAttribute() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Attribute> attribute; | |
/** | |
* The cached value of the '{@link #getAnnotation() <em>Annotation</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getAnnotation() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Annotation> annotation; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected ElementImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return CorePackage.Literals.ELEMENT; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Attribute> getAttribute() { | |
if (attribute == null) { | |
attribute = new EObjectContainmentEList<Attribute>(Attribute.class, this, CorePackage.ELEMENT__ATTRIBUTE); | |
} | |
return attribute; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Annotation> getAnnotation() { | |
if (annotation == null) { | |
annotation = new EObjectContainmentEList<Annotation>(Annotation.class, this, CorePackage.ELEMENT__ANNOTATION); | |
} | |
return annotation; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case CorePackage.ELEMENT__ATTRIBUTE: | |
return ((InternalEList<?>)getAttribute()).basicRemove(otherEnd, msgs); | |
case CorePackage.ELEMENT__ANNOTATION: | |
return ((InternalEList<?>)getAnnotation()).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 CorePackage.ELEMENT__ATTRIBUTE: | |
return getAttribute(); | |
case CorePackage.ELEMENT__ANNOTATION: | |
return getAnnotation(); | |
} | |
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 CorePackage.ELEMENT__ATTRIBUTE: | |
getAttribute().clear(); | |
getAttribute().addAll((Collection<? extends Attribute>)newValue); | |
return; | |
case CorePackage.ELEMENT__ANNOTATION: | |
getAnnotation().clear(); | |
getAnnotation().addAll((Collection<? extends Annotation>)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case CorePackage.ELEMENT__ATTRIBUTE: | |
getAttribute().clear(); | |
return; | |
case CorePackage.ELEMENT__ANNOTATION: | |
getAnnotation().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case CorePackage.ELEMENT__ATTRIBUTE: | |
return attribute != null && !attribute.isEmpty(); | |
case CorePackage.ELEMENT__ANNOTATION: | |
return annotation != null && !annotation.isEmpty(); | |
} | |
return super.eIsSet(featureID); | |
} | |
} //ElementImpl |