| /******************************************************************************* |
| * Copyright (c) 2013, 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.ocl.examples.autogen.autocgmodel.impl; |
| |
| import java.util.Collection; |
| import java.util.List; |
| |
| 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.EClassifier; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.jdt.annotation.Nullable; |
| import org.eclipse.ocl.examples.autogen.autocgmodel.AutoCGModelPackage; |
| import org.eclipse.ocl.examples.autogen.autocgmodel.CGContainmentBody; |
| import org.eclipse.ocl.examples.autogen.autocgmodel.CGContainmentPart; |
| import org.eclipse.ocl.examples.autogen.autocgmodel.CGContainmentVisit; |
| import org.eclipse.ocl.examples.autogen.autocgmodel.util.AutoCGModelVisitor; |
| import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement; |
| import org.eclipse.ocl.examples.codegen.cgmodel.impl.CGValuedElementImpl; |
| import org.eclipse.ocl.examples.codegen.cgmodel.util.CGModelVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>CG Containment Body</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.ocl.examples.autogen.autocgmodel.impl.CGContainmentBodyImpl#getContainmentVisit <em>Containment Visit</em>}</li> |
| * <li>{@link org.eclipse.ocl.examples.autogen.autocgmodel.impl.CGContainmentBodyImpl#getParts <em>Parts</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class CGContainmentBodyImpl extends CGValuedElementImpl implements CGContainmentBody { |
| /** |
| * The cached value of the '{@link #getContainmentVisit() <em>Containment Visit</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContainmentVisit() |
| * @generated |
| * @ordered |
| */ |
| protected CGContainmentVisit containmentVisit; |
| |
| /** |
| * The cached value of the '{@link #getParts() <em>Parts</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getParts() |
| * @generated |
| * @ordered |
| */ |
| protected EList<CGContainmentPart> parts; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CGContainmentBodyImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AutoCGModelPackage.Literals.CG_CONTAINMENT_BODY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public CGContainmentVisit getContainmentVisit() { |
| return containmentVisit; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setContainmentVisit(CGContainmentVisit newContainmentVisit) { |
| CGContainmentVisit oldContainmentVisit = containmentVisit; |
| containmentVisit = newContainmentVisit; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AutoCGModelPackage.CG_CONTAINMENT_BODY__CONTAINMENT_VISIT, oldContainmentVisit, containmentVisit)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public List<CGContainmentPart> getParts() { |
| if (parts == null) { |
| parts = new EObjectContainmentWithInverseEList<CGContainmentPart>(CGContainmentPart.class, this, AutoCGModelPackage.CG_CONTAINMENT_BODY__PARTS, AutoCGModelPackage.CG_CONTAINMENT_PART__CONTAINMENT_BODY); |
| } |
| return parts; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AutoCGModelPackage.CG_CONTAINMENT_BODY__PARTS: |
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getParts()).basicAdd(otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AutoCGModelPackage.CG_CONTAINMENT_BODY__PARTS: |
| return ((InternalEList<?>)getParts()).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 AutoCGModelPackage.CG_CONTAINMENT_BODY__CONTAINMENT_VISIT: |
| return getContainmentVisit(); |
| case AutoCGModelPackage.CG_CONTAINMENT_BODY__PARTS: |
| return getParts(); |
| } |
| 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 AutoCGModelPackage.CG_CONTAINMENT_BODY__CONTAINMENT_VISIT: |
| setContainmentVisit((CGContainmentVisit)newValue); |
| return; |
| case AutoCGModelPackage.CG_CONTAINMENT_BODY__PARTS: |
| getParts().clear(); |
| getParts().addAll((Collection<? extends CGContainmentPart>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AutoCGModelPackage.CG_CONTAINMENT_BODY__CONTAINMENT_VISIT: |
| setContainmentVisit((CGContainmentVisit)null); |
| return; |
| case AutoCGModelPackage.CG_CONTAINMENT_BODY__PARTS: |
| getParts().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AutoCGModelPackage.CG_CONTAINMENT_BODY__CONTAINMENT_VISIT: |
| return containmentVisit != null; |
| case AutoCGModelPackage.CG_CONTAINMENT_BODY__PARTS: |
| return parts != null && !parts.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public @Nullable <R> R accept(@NonNull CGModelVisitor<R> visitor) { |
| return (R) ((AutoCGModelVisitor<?>)visitor).visitCGContainmentBody(this); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public @Nullable EClassifier getEcoreClassifier() { |
| return null; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isAssertedNonNull() { |
| return false; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isBoxed() { |
| return false; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isCommonable() { |
| return false; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isEcore() { |
| return false; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public @Nullable Boolean isEquivalentToInternal(@NonNull CGValuedElement thatValue) { |
| throw new UnsupportedOperationException(getClass().getName() + ".isEquivalentToInternal()"); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isGlobal() { |
| return false; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isNonNull() { |
| return true; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isNull() { |
| return false; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isUnboxed() { |
| return true; |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public boolean isUncommonable() { |
| return true; |
| } |
| |
| } //CGContainmentBodyImpl |