blob: 7e071e5b7f55ab2e56e91356c5354cf56ffd8960 [file] [log] [blame]
/**
* Copyright (c) 2016 CEA LIST.
*
* 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:
* CEA LIST - Initial API and implementation
*
*/
package org.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.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.omg.smm.Annotation;
import org.omg.smm.Attribute;
import org.omg.smm.SmmElement;
import org.omg.smm.SmmPackage;
import org.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:
* </p>
* <ul>
* <li>{@link org.omg.smm.impl.SmmElementImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.omg.smm.impl.SmmElementImpl#getName <em>Name</em>}</li>
* <li>{@link org.omg.smm.impl.SmmElementImpl#getShortDescription <em>Short Description</em>}</li>
* <li>{@link org.omg.smm.impl.SmmElementImpl#getInRelationships <em>In Relationships</em>}</li>
* <li>{@link org.omg.smm.impl.SmmElementImpl#getOutRelationships <em>Out Relationships</em>}</li>
* <li>{@link org.omg.smm.impl.SmmElementImpl#getAttributes <em>Attributes</em>}</li>
* <li>{@link org.omg.smm.impl.SmmElementImpl#getAnnotations <em>Annotations</em>}</li>
* </ul>
*
* @generated
*/
public abstract class SmmElementImpl extends MinimalEObjectImpl.Container implements SmmElement {
/**
* 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 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 cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributes()
* @generated
* @ordered
*/
protected EList<Attribute> attributes;
/**
* The cached value of the '{@link #getAnnotations() <em>Annotations</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnnotations()
* @generated
* @ordered
*/
protected EList<Annotation> annotations;
/**
* <!-- 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 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 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 EList<SmmRelationship> getInRelationships() {
// TODO: implement this method to return the 'In Relationships' reference list
// Ensure that you remove @generated or mark it @generated NOT
// The list is expected to implement org.eclipse.emf.ecore.util.InternalEList and org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of org.eclipse.emf.ecore.util.EcoreEList should be used.
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<SmmRelationship> getOutRelationships() {
// TODO: implement this method to return the 'Out Relationships' reference list
// Ensure that you remove @generated or mark it @generated NOT
// The list is expected to implement org.eclipse.emf.ecore.util.InternalEList and org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of org.eclipse.emf.ecore.util.EcoreEList should be used.
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Attribute> getAttributes() {
if (attributes == null) {
attributes = new EObjectContainmentEList<Attribute>(Attribute.class, this, SmmPackage.SMM_ELEMENT__ATTRIBUTES);
}
return attributes;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Annotation> getAnnotations() {
if (annotations == null) {
annotations = new EObjectContainmentEList<Annotation>(Annotation.class, this, SmmPackage.SMM_ELEMENT__ANNOTATIONS);
}
return annotations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SmmPackage.SMM_ELEMENT__ATTRIBUTES:
return ((InternalEList<?>)getAttributes()).basicRemove(otherEnd, msgs);
case SmmPackage.SMM_ELEMENT__ANNOTATIONS:
return ((InternalEList<?>)getAnnotations()).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__DESCRIPTION:
return getDescription();
case SmmPackage.SMM_ELEMENT__NAME:
return getName();
case SmmPackage.SMM_ELEMENT__SHORT_DESCRIPTION:
return getShortDescription();
case SmmPackage.SMM_ELEMENT__IN_RELATIONSHIPS:
return getInRelationships();
case SmmPackage.SMM_ELEMENT__OUT_RELATIONSHIPS:
return getOutRelationships();
case SmmPackage.SMM_ELEMENT__ATTRIBUTES:
return getAttributes();
case SmmPackage.SMM_ELEMENT__ANNOTATIONS:
return getAnnotations();
}
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__DESCRIPTION:
setDescription((String)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__IN_RELATIONSHIPS:
getInRelationships().clear();
getInRelationships().addAll((Collection<? extends SmmRelationship>)newValue);
return;
case SmmPackage.SMM_ELEMENT__OUT_RELATIONSHIPS:
getOutRelationships().clear();
getOutRelationships().addAll((Collection<? extends SmmRelationship>)newValue);
return;
case SmmPackage.SMM_ELEMENT__ATTRIBUTES:
getAttributes().clear();
getAttributes().addAll((Collection<? extends Attribute>)newValue);
return;
case SmmPackage.SMM_ELEMENT__ANNOTATIONS:
getAnnotations().clear();
getAnnotations().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 SmmPackage.SMM_ELEMENT__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
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__IN_RELATIONSHIPS:
getInRelationships().clear();
return;
case SmmPackage.SMM_ELEMENT__OUT_RELATIONSHIPS:
getOutRelationships().clear();
return;
case SmmPackage.SMM_ELEMENT__ATTRIBUTES:
getAttributes().clear();
return;
case SmmPackage.SMM_ELEMENT__ANNOTATIONS:
getAnnotations().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SmmPackage.SMM_ELEMENT__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
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__IN_RELATIONSHIPS:
return !getInRelationships().isEmpty();
case SmmPackage.SMM_ELEMENT__OUT_RELATIONSHIPS:
return !getOutRelationships().isEmpty();
case SmmPackage.SMM_ELEMENT__ATTRIBUTES:
return attributes != null && !attributes.isEmpty();
case SmmPackage.SMM_ELEMENT__ANNOTATIONS:
return annotations != null && !annotations.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(" (description: ");
result.append(description);
result.append(", name: ");
result.append(name);
result.append(", shortDescription: ");
result.append(shortDescription);
result.append(')');
return result.toString();
}
} //SmmElementImpl