| /** |
| * * 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.asm.simpleRules.impl; |
| |
| import java.util.Collection; |
| |
| 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.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.Rule; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.CallRule; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.SimpleRulesPackage; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.Term; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Call Rule</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.impl.CallRuleImpl#getRule <em>Rule</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.impl.CallRuleImpl#getActualParameters <em>Actual Parameters</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class CallRuleImpl extends ASMRuleInvocationImpl implements CallRule |
| { |
| /** |
| * <!-- 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 #getRule() <em>Rule</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRule() |
| * @generated |
| * @ordered |
| */ |
| protected Rule rule; |
| |
| /** |
| * The cached value of the '{@link #getActualParameters() <em>Actual Parameters</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getActualParameters() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Term> actualParameters; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CallRuleImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return SimpleRulesPackage.Literals.CALL_RULE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Rule getRule() |
| { |
| if (rule != null && rule.eIsProxy()) |
| { |
| InternalEObject oldRule = (InternalEObject)rule; |
| rule = (Rule)eResolveProxy(oldRule); |
| if (rule != oldRule) |
| { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, SimpleRulesPackage.CALL_RULE__RULE, oldRule, rule)); |
| } |
| } |
| return rule; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Rule basicGetRule() |
| { |
| return rule; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRule(Rule newRule) |
| { |
| Rule oldRule = rule; |
| rule = newRule; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CALL_RULE__RULE, oldRule, rule)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Term> getActualParameters() |
| { |
| if (actualParameters == null) |
| { |
| actualParameters = new EObjectContainmentEList<Term>(Term.class, this, SimpleRulesPackage.CALL_RULE__ACTUAL_PARAMETERS); |
| } |
| return actualParameters; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case SimpleRulesPackage.CALL_RULE__ACTUAL_PARAMETERS: |
| return ((InternalEList<?>)getActualParameters()).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 SimpleRulesPackage.CALL_RULE__RULE: |
| if (resolve) return getRule(); |
| return basicGetRule(); |
| case SimpleRulesPackage.CALL_RULE__ACTUAL_PARAMETERS: |
| return getActualParameters(); |
| } |
| 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 SimpleRulesPackage.CALL_RULE__RULE: |
| setRule((Rule)newValue); |
| return; |
| case SimpleRulesPackage.CALL_RULE__ACTUAL_PARAMETERS: |
| getActualParameters().clear(); |
| getActualParameters().addAll((Collection<? extends Term>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case SimpleRulesPackage.CALL_RULE__RULE: |
| setRule((Rule)null); |
| return; |
| case SimpleRulesPackage.CALL_RULE__ACTUAL_PARAMETERS: |
| getActualParameters().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case SimpleRulesPackage.CALL_RULE__RULE: |
| return rule != null; |
| case SimpleRulesPackage.CALL_RULE__ACTUAL_PARAMETERS: |
| return actualParameters != null && !actualParameters.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //CallRuleImpl |