blob: 9969a083b9ebb18ff5072445d357b613b7cfe3eb [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2012 E.D.Willink 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.qvtcorecs.impl;
import java.util.Collection;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.qvtd.pivot.qvtcore.Mapping;
import org.eclipse.qvtd.xtext.qvtcorebasecs.impl.AbstractMappingCSImpl;
import org.eclipse.qvtd.xtext.qvtcorecs.MappingCS;
import org.eclipse.qvtd.xtext.qvtcorecs.QVTcoreCSPackage;
import org.eclipse.qvtd.xtext.qvtcorecs.util.QVTcoreCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Mapping CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtcorecs.impl.MappingCSImpl#getOwnedComposedMappings <em>Owned Composed Mappings</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtcorecs.impl.MappingCSImpl#getRefines <em>Refines</em>}</li>
* </ul>
*
* @generated
*/
public class MappingCSImpl extends AbstractMappingCSImpl implements MappingCS {
/**
* The cached value of the '{@link #getOwnedComposedMappings() <em>Owned Composed Mappings</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedComposedMappings()
* @generated
* @ordered
*/
protected EList<MappingCS> ownedComposedMappings;
/**
* The cached value of the '{@link #getRefines() <em>Refines</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRefines()
* @generated
* @ordered
*/
protected EList<Mapping> refines;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MappingCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTcoreCSPackage.Literals.MAPPING_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<MappingCS> getOwnedComposedMappings() {
if (ownedComposedMappings == null) {
ownedComposedMappings = new EObjectContainmentEList<MappingCS>(MappingCS.class, this, QVTcoreCSPackage.MAPPING_CS__OWNED_COMPOSED_MAPPINGS);
}
return ownedComposedMappings;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Mapping> getRefines() {
if (refines == null) {
refines = new EObjectResolvingEList<Mapping>(Mapping.class, this, QVTcoreCSPackage.MAPPING_CS__REFINES);
}
return refines;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QVTcoreCSPackage.MAPPING_CS__OWNED_COMPOSED_MAPPINGS:
return ((InternalEList<?>)getOwnedComposedMappings()).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 QVTcoreCSPackage.MAPPING_CS__OWNED_COMPOSED_MAPPINGS:
return getOwnedComposedMappings();
case QVTcoreCSPackage.MAPPING_CS__REFINES:
return getRefines();
}
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 QVTcoreCSPackage.MAPPING_CS__OWNED_COMPOSED_MAPPINGS:
getOwnedComposedMappings().clear();
getOwnedComposedMappings().addAll((Collection<? extends MappingCS>)newValue);
return;
case QVTcoreCSPackage.MAPPING_CS__REFINES:
getRefines().clear();
getRefines().addAll((Collection<? extends Mapping>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QVTcoreCSPackage.MAPPING_CS__OWNED_COMPOSED_MAPPINGS:
getOwnedComposedMappings().clear();
return;
case QVTcoreCSPackage.MAPPING_CS__REFINES:
getRefines().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QVTcoreCSPackage.MAPPING_CS__OWNED_COMPOSED_MAPPINGS:
return ownedComposedMappings != null && !ownedComposedMappings.isEmpty();
case QVTcoreCSPackage.MAPPING_CS__REFINES:
return refines != null && !refines.isEmpty();
}
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) ((QVTcoreCSVisitor<?>)visitor).visitMappingCS(this);
}
} //MappingCSImpl