/** | |
* Copyright (c) 2010 Mia-Software. | |
* 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: | |
* Nicolas Payneau (Mia-Software) - initial API and implementation | |
*/ | |
package org.eclipse.modisco.omg.smm.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.EObjectWithInverseResolvingEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
import org.eclipse.modisco.omg.smm.Annotation; | |
import org.eclipse.modisco.omg.smm.Attribute; | |
import org.eclipse.modisco.omg.smm.Observation; | |
import org.eclipse.modisco.omg.smm.SmmElement; | |
import org.eclipse.modisco.omg.smm.SmmPackage; | |
import org.eclipse.modisco.omg.smm.SmmRelationship; | |
/** | |
* <!-- 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.modisco.omg.smm.impl.SmmElementImpl#getAttribute <em>Attribute</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.smm.impl.SmmElementImpl#getAnnotation <em>Annotation</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.smm.impl.SmmElementImpl#getName <em>Name</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.smm.impl.SmmElementImpl#getShortDescription <em>Short Description</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.smm.impl.SmmElementImpl#getDescription <em>Description</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.smm.impl.SmmElementImpl#getRequestedObservations <em>Requested Observations</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public abstract class SmmElementImpl extends EObjectImpl implements SmmElement { | |
/** | |
* 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; | |
/** | |
* 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 #getShortDescription() <em>Short Description</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getShortDescription() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String SHORT_DESCRIPTION_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getShortDescription() <em>Short Description</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getShortDescription() | |
* @generated | |
* @ordered | |
*/ | |
protected String shortDescription = SHORT_DESCRIPTION_EDEFAULT; | |
/** | |
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getDescription() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String DESCRIPTION_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getDescription() | |
* @generated | |
* @ordered | |
*/ | |
protected String description = DESCRIPTION_EDEFAULT; | |
/** | |
* The cached value of the '{@link #getRequestedObservations() <em>Requested Observations</em>}' reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getRequestedObservations() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Observation> requestedObservations; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected SmmElementImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return SmmPackage.Literals.SMM_ELEMENT; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Attribute> getAttribute() { | |
if (attribute == null) { | |
attribute = new EObjectContainmentEList<Attribute>(Attribute.class, this, SmmPackage.SMM_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, SmmPackage.SMM_ELEMENT__ANNOTATION); | |
} | |
return annotation; | |
} | |
/** | |
* <!-- 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, SmmPackage.SMM_ELEMENT__NAME, oldName, name)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public String getShortDescription() { | |
return shortDescription; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setShortDescription(String newShortDescription) { | |
String oldShortDescription = shortDescription; | |
shortDescription = newShortDescription; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, SmmPackage.SMM_ELEMENT__SHORT_DESCRIPTION, oldShortDescription, shortDescription)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public String getDescription() { | |
return description; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setDescription(String newDescription) { | |
String oldDescription = description; | |
description = newDescription; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, SmmPackage.SMM_ELEMENT__DESCRIPTION, oldDescription, description)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Observation> getRequestedObservations() { | |
if (requestedObservations == null) { | |
requestedObservations = new EObjectWithInverseResolvingEList.ManyInverse<Observation>(Observation.class, this, SmmPackage.SMM_ELEMENT__REQUESTED_OBSERVATIONS, SmmPackage.OBSERVATION__REQUESTED_MEASURES); | |
} | |
return requestedObservations; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<SmmRelationship> getInbound() { | |
// TODO: implement this method | |
// Ensure that you remove @generated or mark it @generated NOT | |
throw new UnsupportedOperationException(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<SmmRelationship> getOutbound() { | |
// TODO: implement this method | |
// Ensure that you remove @generated or mark it @generated NOT | |
throw new UnsupportedOperationException(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case SmmPackage.SMM_ELEMENT__REQUESTED_OBSERVATIONS: | |
return ((InternalEList<InternalEObject>)(InternalEList<?>)getRequestedObservations()).basicAdd(otherEnd, msgs); | |
} | |
return super.eInverseAdd(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case SmmPackage.SMM_ELEMENT__ATTRIBUTE: | |
return ((InternalEList<?>)getAttribute()).basicRemove(otherEnd, msgs); | |
case SmmPackage.SMM_ELEMENT__ANNOTATION: | |
return ((InternalEList<?>)getAnnotation()).basicRemove(otherEnd, msgs); | |
case SmmPackage.SMM_ELEMENT__REQUESTED_OBSERVATIONS: | |
return ((InternalEList<?>)getRequestedObservations()).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 SmmPackage.SMM_ELEMENT__ATTRIBUTE: | |
return getAttribute(); | |
case SmmPackage.SMM_ELEMENT__ANNOTATION: | |
return getAnnotation(); | |
case SmmPackage.SMM_ELEMENT__NAME: | |
return getName(); | |
case SmmPackage.SMM_ELEMENT__SHORT_DESCRIPTION: | |
return getShortDescription(); | |
case SmmPackage.SMM_ELEMENT__DESCRIPTION: | |
return getDescription(); | |
case SmmPackage.SMM_ELEMENT__REQUESTED_OBSERVATIONS: | |
return getRequestedObservations(); | |
} | |
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 SmmPackage.SMM_ELEMENT__ATTRIBUTE: | |
getAttribute().clear(); | |
getAttribute().addAll((Collection<? extends Attribute>)newValue); | |
return; | |
case SmmPackage.SMM_ELEMENT__ANNOTATION: | |
getAnnotation().clear(); | |
getAnnotation().addAll((Collection<? extends Annotation>)newValue); | |
return; | |
case SmmPackage.SMM_ELEMENT__NAME: | |
setName((String)newValue); | |
return; | |
case SmmPackage.SMM_ELEMENT__SHORT_DESCRIPTION: | |
setShortDescription((String)newValue); | |
return; | |
case SmmPackage.SMM_ELEMENT__DESCRIPTION: | |
setDescription((String)newValue); | |
return; | |
case SmmPackage.SMM_ELEMENT__REQUESTED_OBSERVATIONS: | |
getRequestedObservations().clear(); | |
getRequestedObservations().addAll((Collection<? extends Observation>)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case SmmPackage.SMM_ELEMENT__ATTRIBUTE: | |
getAttribute().clear(); | |
return; | |
case SmmPackage.SMM_ELEMENT__ANNOTATION: | |
getAnnotation().clear(); | |
return; | |
case SmmPackage.SMM_ELEMENT__NAME: | |
setName(NAME_EDEFAULT); | |
return; | |
case SmmPackage.SMM_ELEMENT__SHORT_DESCRIPTION: | |
setShortDescription(SHORT_DESCRIPTION_EDEFAULT); | |
return; | |
case SmmPackage.SMM_ELEMENT__DESCRIPTION: | |
setDescription(DESCRIPTION_EDEFAULT); | |
return; | |
case SmmPackage.SMM_ELEMENT__REQUESTED_OBSERVATIONS: | |
getRequestedObservations().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case SmmPackage.SMM_ELEMENT__ATTRIBUTE: | |
return attribute != null && !attribute.isEmpty(); | |
case SmmPackage.SMM_ELEMENT__ANNOTATION: | |
return annotation != null && !annotation.isEmpty(); | |
case SmmPackage.SMM_ELEMENT__NAME: | |
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); | |
case SmmPackage.SMM_ELEMENT__SHORT_DESCRIPTION: | |
return SHORT_DESCRIPTION_EDEFAULT == null ? shortDescription != null : !SHORT_DESCRIPTION_EDEFAULT.equals(shortDescription); | |
case SmmPackage.SMM_ELEMENT__DESCRIPTION: | |
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); | |
case SmmPackage.SMM_ELEMENT__REQUESTED_OBSERVATIONS: | |
return requestedObservations != null && !requestedObservations.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(", shortDescription: "); | |
result.append(shortDescription); | |
result.append(", description: "); | |
result.append(description); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //SmmElementImpl |