blob: 2564a0fa9abdc6183bfc07b55e033f0002643b1f [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2015-2021 Robert Bosch GmbH and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Generated using Eclipse EMF
*
* *******************************************************************************
*/
package org.eclipse.app4mc.amalthea.model.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import org.eclipse.app4mc.amalthea.model.ActivityGraphItem;
import org.eclipse.app4mc.amalthea.model.AmaltheaExtensions;
import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.Group;
import org.eclipse.app4mc.amalthea.model.IActivityGraphItemContainer;
import org.eclipse.app4mc.amalthea.model.INamed;
import org.eclipse.app4mc.amalthea.model.Namespace;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.ecore.xcore.lib.XcoreCollectionLiterals;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Group</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.GroupImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.GroupImpl#getQualifiedName <em>Qualified Name</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.GroupImpl#getItems <em>Items</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.GroupImpl#isOrdered <em>Ordered</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.GroupImpl#isInterruptible <em>Interruptible</em>}</li>
* </ul>
*
* @generated
*/
public class GroupImpl extends ActivityGraphItemImpl implements Group {
/**
* 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 = "";
/**
* 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 #getQualifiedName() <em>Qualified Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQualifiedName()
* @generated
* @ordered
*/
protected static final String QUALIFIED_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getItems() <em>Items</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getItems()
* @generated
* @ordered
*/
protected EList<ActivityGraphItem> items;
/**
* The default value of the '{@link #isOrdered() <em>Ordered</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOrdered()
* @generated
* @ordered
*/
protected static final boolean ORDERED_EDEFAULT = true;
/**
* The cached value of the '{@link #isOrdered() <em>Ordered</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOrdered()
* @generated
* @ordered
*/
protected boolean ordered = ORDERED_EDEFAULT;
/**
* The default value of the '{@link #isInterruptible() <em>Interruptible</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isInterruptible()
* @since 1.2
* @generated
* @ordered
*/
protected static final boolean INTERRUPTIBLE_EDEFAULT = true;
/**
* The cached value of the '{@link #isInterruptible() <em>Interruptible</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isInterruptible()
* @since 1.2
* @generated
* @ordered
*/
protected boolean interruptible = INTERRUPTIBLE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GroupImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getGroup();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.GROUP__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getQualifiedName() {
return AmaltheaExtensions.toPlainString(this.getQualifiedNameSegments(), this.getDefaultNameSeparator());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<ActivityGraphItem> getItems() {
if (items == null) {
items = new EObjectContainmentEList<ActivityGraphItem>(ActivityGraphItem.class, this, AmaltheaPackage.GROUP__ITEMS);
}
return items;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isOrdered() {
return ordered;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOrdered(boolean newOrdered) {
boolean oldOrdered = ordered;
ordered = newOrdered;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.GROUP__ORDERED, oldOrdered, ordered));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @since 1.2
* @generated
*/
@Override
public boolean isInterruptible() {
return interruptible;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @since 1.2
* @generated
*/
@Override
public void setInterruptible(boolean newInterruptible) {
boolean oldInterruptible = interruptible;
interruptible = newInterruptible;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.GROUP__INTERRUPTIBLE, oldInterruptible, interruptible));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public INamed getNamedContainer() {
INamed _xifexpression = null;
EObject _eContainer = this.eContainer();
if ((_eContainer instanceof INamed)) {
EObject _eContainer_1 = this.eContainer();
_xifexpression = ((INamed) _eContainer_1);
}
else {
_xifexpression = null;
}
return _xifexpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getNamePrefix() {
String _xifexpression = null;
Namespace _namespace = this.getNamespace();
boolean _tripleEquals = (_namespace == null);
if (_tripleEquals) {
return "";
}
else {
_xifexpression = AmaltheaExtensions.toPlainString(this.getNamePrefixSegments(), this.getDefaultNameSeparator());
}
return _xifexpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<String> getQualifiedNameSegments() {
final EList<String> segments = this.getNamePrefixSegments();
String _name = this.getName();
boolean _tripleNotEquals = (_name != null);
if (_tripleNotEquals) {
segments.add(this.getName());
}
return segments;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getDefaultNameSeparator() {
return ".";
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Namespace getNamespace() {
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<String> getNamePrefixSegments() {
EList<String> _elvis = null;
Namespace _namespace = this.getNamespace();
EList<String> _qualifiedNameSegments = null;
if (_namespace!=null) {
_qualifiedNameSegments=_namespace.getQualifiedNameSegments();
}
if (_qualifiedNameSegments != null) {
_elvis = _qualifiedNameSegments;
} else {
BasicEList<String> _newBasicEList = XcoreCollectionLiterals.<String>newBasicEList();
_elvis = _newBasicEList;
}
return _elvis;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.GROUP__ITEMS:
return ((InternalEList<?>)getItems()).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 AmaltheaPackage.GROUP__NAME:
return getName();
case AmaltheaPackage.GROUP__QUALIFIED_NAME:
return getQualifiedName();
case AmaltheaPackage.GROUP__ITEMS:
return getItems();
case AmaltheaPackage.GROUP__ORDERED:
return isOrdered();
case AmaltheaPackage.GROUP__INTERRUPTIBLE:
return isInterruptible();
}
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 AmaltheaPackage.GROUP__NAME:
setName((String)newValue);
return;
case AmaltheaPackage.GROUP__ITEMS:
getItems().clear();
getItems().addAll((Collection<? extends ActivityGraphItem>)newValue);
return;
case AmaltheaPackage.GROUP__ORDERED:
setOrdered((Boolean)newValue);
return;
case AmaltheaPackage.GROUP__INTERRUPTIBLE:
setInterruptible((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.GROUP__NAME:
setName(NAME_EDEFAULT);
return;
case AmaltheaPackage.GROUP__ITEMS:
getItems().clear();
return;
case AmaltheaPackage.GROUP__ORDERED:
setOrdered(ORDERED_EDEFAULT);
return;
case AmaltheaPackage.GROUP__INTERRUPTIBLE:
setInterruptible(INTERRUPTIBLE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.GROUP__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case AmaltheaPackage.GROUP__QUALIFIED_NAME:
return QUALIFIED_NAME_EDEFAULT == null ? getQualifiedName() != null : !QUALIFIED_NAME_EDEFAULT.equals(getQualifiedName());
case AmaltheaPackage.GROUP__ITEMS:
return items != null && !items.isEmpty();
case AmaltheaPackage.GROUP__ORDERED:
return ordered != ORDERED_EDEFAULT;
case AmaltheaPackage.GROUP__INTERRUPTIBLE:
return interruptible != INTERRUPTIBLE_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == INamed.class) {
switch (derivedFeatureID) {
case AmaltheaPackage.GROUP__NAME: return AmaltheaPackage.INAMED__NAME;
case AmaltheaPackage.GROUP__QUALIFIED_NAME: return AmaltheaPackage.INAMED__QUALIFIED_NAME;
default: return -1;
}
}
if (baseClass == IActivityGraphItemContainer.class) {
switch (derivedFeatureID) {
case AmaltheaPackage.GROUP__ITEMS: return AmaltheaPackage.IACTIVITY_GRAPH_ITEM_CONTAINER__ITEMS;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == INamed.class) {
switch (baseFeatureID) {
case AmaltheaPackage.INAMED__NAME: return AmaltheaPackage.GROUP__NAME;
case AmaltheaPackage.INAMED__QUALIFIED_NAME: return AmaltheaPackage.GROUP__QUALIFIED_NAME;
default: return -1;
}
}
if (baseClass == IActivityGraphItemContainer.class) {
switch (baseFeatureID) {
case AmaltheaPackage.IACTIVITY_GRAPH_ITEM_CONTAINER__ITEMS: return AmaltheaPackage.GROUP__ITEMS;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedOperationID(int baseOperationID, Class<?> baseClass) {
if (baseClass == INamed.class) {
switch (baseOperationID) {
case AmaltheaPackage.INAMED___GET_NAMED_CONTAINER: return AmaltheaPackage.GROUP___GET_NAMED_CONTAINER;
case AmaltheaPackage.INAMED___GET_NAME_PREFIX: return AmaltheaPackage.GROUP___GET_NAME_PREFIX;
case AmaltheaPackage.INAMED___GET_QUALIFIED_NAME_SEGMENTS: return AmaltheaPackage.GROUP___GET_QUALIFIED_NAME_SEGMENTS;
case AmaltheaPackage.INAMED___GET_DEFAULT_NAME_SEPARATOR: return AmaltheaPackage.GROUP___GET_DEFAULT_NAME_SEPARATOR;
case AmaltheaPackage.INAMED___GET_NAMESPACE: return AmaltheaPackage.GROUP___GET_NAMESPACE;
case AmaltheaPackage.INAMED___GET_NAME_PREFIX_SEGMENTS: return AmaltheaPackage.GROUP___GET_NAME_PREFIX_SEGMENTS;
default: return -1;
}
}
if (baseClass == IActivityGraphItemContainer.class) {
switch (baseOperationID) {
default: return -1;
}
}
return super.eDerivedOperationID(baseOperationID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case AmaltheaPackage.GROUP___GET_NAMED_CONTAINER:
return getNamedContainer();
case AmaltheaPackage.GROUP___GET_NAME_PREFIX:
return getNamePrefix();
case AmaltheaPackage.GROUP___GET_QUALIFIED_NAME_SEGMENTS:
return getQualifiedNameSegments();
case AmaltheaPackage.GROUP___GET_DEFAULT_NAME_SEPARATOR:
return getDefaultNameSeparator();
case AmaltheaPackage.GROUP___GET_NAMESPACE:
return getNamespace();
case AmaltheaPackage.GROUP___GET_NAME_PREFIX_SEGMENTS:
return getNamePrefixSegments();
}
return super.eInvoke(operationID, arguments);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", ordered: ");
result.append(ordered);
result.append(", interruptible: ");
result.append(interruptible);
result.append(')');
return result.toString();
}
} //GroupImpl