| /** |
| * * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro |
| * * 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: |
| * * Istvan Rath, Daniel Varro - initial API and implementation |
| * |
| */ |
| package org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.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.emf.ecore.util.EcoreUtil; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl.GTASMElementImpl; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.GTPatternCall; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.TermsPackage; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.VariableReference; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.GTMatchCounter; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.GtPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>GT Match Counter</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.impl.GTMatchCounterImpl#getPatternCall <em>Pattern Call</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.impl.GTMatchCounterImpl#getVariableReference <em>Variable Reference</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class GTMatchCounterImpl extends GTASMElementImpl implements GTMatchCounter |
| { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final String copyright = " * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors:\r\n * Istvan Rath, Daniel Varro - initial API and implementation\r\n"; |
| |
| /** |
| * The cached value of the '{@link #getVariableReference() <em>Variable Reference</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getVariableReference() |
| * @generated |
| * @ordered |
| */ |
| protected VariableReference variableReference; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected GTMatchCounterImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return GtPackage.Literals.GT_MATCH_COUNTER; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public GTPatternCall getPatternCall() |
| { |
| if (eContainerFeatureID() != GtPackage.GT_MATCH_COUNTER__PATTERN_CALL) return null; |
| return (GTPatternCall)eContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetPatternCall(GTPatternCall newPatternCall, NotificationChain msgs) |
| { |
| msgs = eBasicSetContainer((InternalEObject)newPatternCall, GtPackage.GT_MATCH_COUNTER__PATTERN_CALL, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPatternCall(GTPatternCall newPatternCall) |
| { |
| if (newPatternCall != eInternalContainer() || (eContainerFeatureID() != GtPackage.GT_MATCH_COUNTER__PATTERN_CALL && newPatternCall != null)) |
| { |
| if (EcoreUtil.isAncestor(this, newPatternCall)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newPatternCall != null) |
| msgs = ((InternalEObject)newPatternCall).eInverseAdd(this, TermsPackage.GT_PATTERN_CALL__MATCH_COUNTER, GTPatternCall.class, msgs); |
| msgs = basicSetPatternCall(newPatternCall, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, GtPackage.GT_MATCH_COUNTER__PATTERN_CALL, newPatternCall, newPatternCall)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public VariableReference getVariableReference() |
| { |
| return variableReference; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetVariableReference(VariableReference newVariableReference, NotificationChain msgs) |
| { |
| VariableReference oldVariableReference = variableReference; |
| variableReference = newVariableReference; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE, oldVariableReference, newVariableReference); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setVariableReference(VariableReference newVariableReference) |
| { |
| if (newVariableReference != variableReference) |
| { |
| NotificationChain msgs = null; |
| if (variableReference != null) |
| msgs = ((InternalEObject)variableReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE, null, msgs); |
| if (newVariableReference != null) |
| msgs = ((InternalEObject)newVariableReference).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE, null, msgs); |
| msgs = basicSetVariableReference(newVariableReference, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE, newVariableReference, newVariableReference)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case GtPackage.GT_MATCH_COUNTER__PATTERN_CALL: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetPatternCall((GTPatternCall)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 GtPackage.GT_MATCH_COUNTER__PATTERN_CALL: |
| return basicSetPatternCall(null, msgs); |
| case GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE: |
| return basicSetVariableReference(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) |
| { |
| switch (eContainerFeatureID()) |
| { |
| case GtPackage.GT_MATCH_COUNTER__PATTERN_CALL: |
| return eInternalContainer().eInverseRemove(this, TermsPackage.GT_PATTERN_CALL__MATCH_COUNTER, GTPatternCall.class, msgs); |
| } |
| return super.eBasicRemoveFromContainerFeature(msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) |
| { |
| switch (featureID) |
| { |
| case GtPackage.GT_MATCH_COUNTER__PATTERN_CALL: |
| return getPatternCall(); |
| case GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE: |
| return getVariableReference(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case GtPackage.GT_MATCH_COUNTER__PATTERN_CALL: |
| setPatternCall((GTPatternCall)newValue); |
| return; |
| case GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE: |
| setVariableReference((VariableReference)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case GtPackage.GT_MATCH_COUNTER__PATTERN_CALL: |
| setPatternCall((GTPatternCall)null); |
| return; |
| case GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE: |
| setVariableReference((VariableReference)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case GtPackage.GT_MATCH_COUNTER__PATTERN_CALL: |
| return getPatternCall() != null; |
| case GtPackage.GT_MATCH_COUNTER__VARIABLE_REFERENCE: |
| return variableReference != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //GTMatchCounterImpl |