blob: 581afad35e52fb2f54a3372de7209794c0cca9c0 [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.util.Collection;
import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.CoherencyDirection;
import org.eclipse.app4mc.amalthea.model.DataCoherencyGroup;
import org.eclipse.app4mc.amalthea.model.DataGroupScope;
import org.eclipse.app4mc.amalthea.model.Label;
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.EObjectResolvingEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Data Coherency Group</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.DataCoherencyGroupImpl#getLabels <em>Labels</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.DataCoherencyGroupImpl#getScope <em>Scope</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.DataCoherencyGroupImpl#getDirection <em>Direction</em>}</li>
* </ul>
*
* @generated
*/
public class DataCoherencyGroupImpl extends ReferableBaseObjectImpl implements DataCoherencyGroup {
/**
* The cached value of the '{@link #getLabels() <em>Labels</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabels()
* @generated
* @ordered
*/
protected EList<Label> labels;
/**
* The cached value of the '{@link #getScope() <em>Scope</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getScope()
* @generated
* @ordered
*/
protected DataGroupScope scope;
/**
* The default value of the '{@link #getDirection() <em>Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
* @generated
* @ordered
*/
protected static final CoherencyDirection DIRECTION_EDEFAULT = CoherencyDirection._UNDEFINED_;
/**
* The cached value of the '{@link #getDirection() <em>Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
* @generated
* @ordered
*/
protected CoherencyDirection direction = DIRECTION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DataCoherencyGroupImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getDataCoherencyGroup();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Label> getLabels() {
if (labels == null) {
labels = new EObjectResolvingEList<Label>(Label.class, this, AmaltheaPackage.DATA_COHERENCY_GROUP__LABELS);
}
return labels;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public DataGroupScope getScope() {
return scope;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetScope(DataGroupScope newScope, NotificationChain msgs) {
DataGroupScope oldScope = scope;
scope = newScope;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE, oldScope, newScope);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setScope(DataGroupScope newScope) {
if (newScope != scope) {
NotificationChain msgs = null;
if (scope != null)
msgs = ((InternalEObject)scope).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE, null, msgs);
if (newScope != null)
msgs = ((InternalEObject)newScope).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE, null, msgs);
msgs = basicSetScope(newScope, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE, newScope, newScope));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public CoherencyDirection getDirection() {
return direction;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setDirection(CoherencyDirection newDirection) {
CoherencyDirection oldDirection = direction;
direction = newDirection == null ? DIRECTION_EDEFAULT : newDirection;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.DATA_COHERENCY_GROUP__DIRECTION, oldDirection, direction));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE:
return basicSetScope(null, 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.DATA_COHERENCY_GROUP__LABELS:
return getLabels();
case AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE:
return getScope();
case AmaltheaPackage.DATA_COHERENCY_GROUP__DIRECTION:
return getDirection();
}
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.DATA_COHERENCY_GROUP__LABELS:
getLabels().clear();
getLabels().addAll((Collection<? extends Label>)newValue);
return;
case AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE:
setScope((DataGroupScope)newValue);
return;
case AmaltheaPackage.DATA_COHERENCY_GROUP__DIRECTION:
setDirection((CoherencyDirection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.DATA_COHERENCY_GROUP__LABELS:
getLabels().clear();
return;
case AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE:
setScope((DataGroupScope)null);
return;
case AmaltheaPackage.DATA_COHERENCY_GROUP__DIRECTION:
setDirection(DIRECTION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.DATA_COHERENCY_GROUP__LABELS:
return labels != null && !labels.isEmpty();
case AmaltheaPackage.DATA_COHERENCY_GROUP__SCOPE:
return scope != null;
case AmaltheaPackage.DATA_COHERENCY_GROUP__DIRECTION:
return direction != DIRECTION_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (direction: ");
result.append(direction);
result.append(')');
return result.toString();
}
} //DataCoherencyGroupImpl