| /******************************************************************************* |
| * 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.qvtcorebasecs.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.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.xtext.qvtcorebasecs.GuardPatternCS; |
| import org.eclipse.qvtd.xtext.qvtcorebasecs.PredicateCS; |
| import org.eclipse.qvtd.xtext.qvtcorebasecs.QVTcoreBaseCSPackage; |
| import org.eclipse.qvtd.xtext.qvtcorebasecs.util.QVTcoreBaseCSVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Guard Pattern CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtcorebasecs.impl.GuardPatternCSImpl#getOwnedPredicates <em>Owned Predicates</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class GuardPatternCSImpl extends PatternCSImpl implements GuardPatternCS { |
| /** |
| * The cached value of the '{@link #getOwnedPredicates() <em>Owned Predicates</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedPredicates() |
| * @generated |
| * @ordered |
| */ |
| protected EList<PredicateCS> ownedPredicates; |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected GuardPatternCSImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return QVTcoreBaseCSPackage.Literals.GUARD_PATTERN_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<PredicateCS> getOwnedPredicates() { |
| if (ownedPredicates == null) { |
| ownedPredicates = new EObjectContainmentEList<PredicateCS>(PredicateCS.class, this, QVTcoreBaseCSPackage.GUARD_PATTERN_CS__OWNED_PREDICATES); |
| } |
| return ownedPredicates; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case QVTcoreBaseCSPackage.GUARD_PATTERN_CS__OWNED_PREDICATES: |
| return ((InternalEList<?>)getOwnedPredicates()).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 QVTcoreBaseCSPackage.GUARD_PATTERN_CS__OWNED_PREDICATES: |
| return getOwnedPredicates(); |
| } |
| 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 QVTcoreBaseCSPackage.GUARD_PATTERN_CS__OWNED_PREDICATES: |
| getOwnedPredicates().clear(); |
| getOwnedPredicates().addAll((Collection<? extends PredicateCS>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case QVTcoreBaseCSPackage.GUARD_PATTERN_CS__OWNED_PREDICATES: |
| getOwnedPredicates().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case QVTcoreBaseCSPackage.GUARD_PATTERN_CS__OWNED_PREDICATES: |
| return ownedPredicates != null && !ownedPredicates.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) ((QVTcoreBaseCSVisitor<?>)visitor).visitGuardPatternCS(this); |
| } |
| } //GuardPatternCSImpl |