blob: 4738992a7e2ae5f71fb81f372d84192b5c521f3d [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2012, 2015 Willink Transformations and others.
* 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:
* E.D.Willink - initial API and implementation
*******************************************************************************/
package org.eclipse.qvtd.xtext.qvtrelationcs.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.xtext.basecs.impl.ModelElementCSImpl;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.qvtd.xtext.qvtrelationcs.DomainPatternCS;
import org.eclipse.qvtd.xtext.qvtrelationcs.QVTrelationCSPackage;
import org.eclipse.qvtd.xtext.qvtrelationcs.TemplateCS;
import org.eclipse.qvtd.xtext.qvtrelationcs.util.QVTrelationCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Domain Pattern CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.DomainPatternCSImpl#getOwnedTemplate <em>Owned Template</em>}</li>
* </ul>
*
* @generated
*/
public class DomainPatternCSImpl extends ModelElementCSImpl implements DomainPatternCS {
/**
* The cached value of the '{@link #getOwnedTemplate() <em>Owned Template</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedTemplate()
* @generated
* @ordered
*/
protected TemplateCS ownedTemplate;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DomainPatternCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTrelationCSPackage.Literals.DOMAIN_PATTERN_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public TemplateCS getOwnedTemplate() {
return ownedTemplate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedTemplate(TemplateCS newOwnedTemplate, NotificationChain msgs) {
TemplateCS oldOwnedTemplate = ownedTemplate;
ownedTemplate = newOwnedTemplate;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE, oldOwnedTemplate, newOwnedTemplate);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwnedTemplate(TemplateCS newOwnedTemplate) {
if (newOwnedTemplate != ownedTemplate) {
NotificationChain msgs = null;
if (ownedTemplate != null)
msgs = ((InternalEObject)ownedTemplate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE, null, msgs);
if (newOwnedTemplate != null)
msgs = ((InternalEObject)newOwnedTemplate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE, null, msgs);
msgs = basicSetOwnedTemplate(newOwnedTemplate, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE, newOwnedTemplate, newOwnedTemplate));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE:
return basicSetOwnedTemplate(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 QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE:
return getOwnedTemplate();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE:
setOwnedTemplate((TemplateCS)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE:
setOwnedTemplate((TemplateCS)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QVTrelationCSPackage.DOMAIN_PATTERN_CS__OWNED_TEMPLATE:
return ownedTemplate != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public @Nullable <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
return (R) ((QVTrelationCSVisitor<?>)visitor).visitDomainPatternCS(this);
}
} //DomainPatternCSImpl