| /******************************************************************************* |
| * Copyright (c) 2006, 2018 IBM Corporation, Zeligsoft Inc., and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * IBM - Initial API and implementation |
| * Zeligsoft - Bug 207365 |
| *******************************************************************************/ |
| package org.eclipse.ocl.expressions.impl; |
| |
| import java.util.Collection; |
| |
| import java.util.Map; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.common.util.DiagnosticChain; |
| 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.InternalEList; |
| import org.eclipse.ocl.expressions.ExpressionsPackage; |
| import org.eclipse.ocl.expressions.TupleLiteralExp; |
| import org.eclipse.ocl.expressions.TupleLiteralPart; |
| import org.eclipse.ocl.expressions.operations.TupleLiteralExpOperations; |
| import org.eclipse.ocl.utilities.Visitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Tuple Literal Exp</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.ocl.expressions.impl.TupleLiteralExpImpl#getPart <em>Part</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class TupleLiteralExpImpl<C, P> |
| extends LiteralExpImpl<C> |
| implements TupleLiteralExp<C, P> { |
| |
| /** |
| * The cached value of the '{@link #getPart() <em>Part</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPart() |
| * @generated |
| * @ordered |
| */ |
| protected EList<TupleLiteralPart<C, P>> part; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TupleLiteralExpImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ExpressionsPackage.Literals.TUPLE_LITERAL_EXP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<TupleLiteralPart<C, P>> getPart() { |
| if (part == null) { |
| part = new EObjectContainmentEList<TupleLiteralPart<C, P>>( |
| TupleLiteralPart.class, this, |
| ExpressionsPackage.TUPLE_LITERAL_EXP__PART); |
| } |
| return part; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean checkTupleType(DiagnosticChain diagnostics, |
| Map<Object, Object> context) { |
| return TupleLiteralExpOperations.checkTupleType(this, diagnostics, |
| context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean checkPartsUnique(DiagnosticChain diagnostics, |
| Map<Object, Object> context) { |
| return TupleLiteralExpOperations.checkPartsUnique(this, diagnostics, |
| context); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ExpressionsPackage.TUPLE_LITERAL_EXP__PART : |
| return ((InternalEList<?>) getPart()).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 ExpressionsPackage.TUPLE_LITERAL_EXP__PART : |
| return getPart(); |
| } |
| 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 ExpressionsPackage.TUPLE_LITERAL_EXP__PART : |
| getPart().clear(); |
| getPart().addAll( |
| (Collection<? extends TupleLiteralPart<C, P>>) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ExpressionsPackage.TUPLE_LITERAL_EXP__PART : |
| getPart().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ExpressionsPackage.TUPLE_LITERAL_EXP__PART : |
| return part != null && !part.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * @generated NOT |
| */ |
| @Override |
| @SuppressWarnings("unchecked") |
| public <T, U extends Visitor<T, ?, ?, ?, ?, ?, ?, ?, ?, ?>> T accept(U v) { |
| return ((Visitor<T, C, ?, P, ?, ?, ?, ?, ?, ?>) v) |
| .visitTupleLiteralExp(this); |
| } |
| |
| } //TupleLiteralExpImpl |