| /** |
| * * 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 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.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.ASMRuleInvocation; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.ConditionalRuleIf; |
| 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>Conditional Rule If</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.impl.ConditionalRuleIfImpl#getExpressionToTest <em>Expression To Test</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.impl.ConditionalRuleIfImpl#getRuleTrue <em>Rule True</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.impl.ConditionalRuleIfImpl#getRuleFalse <em>Rule False</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ConditionalRuleIfImpl extends ASMRuleInvocationImpl implements ConditionalRuleIf |
| { |
| /** |
| * <!-- 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 #getExpressionToTest() <em>Expression To Test</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExpressionToTest() |
| * @generated |
| * @ordered |
| */ |
| protected Term expressionToTest; |
| |
| /** |
| * The cached value of the '{@link #getRuleTrue() <em>Rule True</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRuleTrue() |
| * @generated |
| * @ordered |
| */ |
| protected ASMRuleInvocation ruleTrue; |
| |
| /** |
| * The cached value of the '{@link #getRuleFalse() <em>Rule False</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRuleFalse() |
| * @generated |
| * @ordered |
| */ |
| protected ASMRuleInvocation ruleFalse; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ConditionalRuleIfImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return SimpleRulesPackage.Literals.CONDITIONAL_RULE_IF; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Term getExpressionToTest() |
| { |
| return expressionToTest; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetExpressionToTest(Term newExpressionToTest, NotificationChain msgs) |
| { |
| Term oldExpressionToTest = expressionToTest; |
| expressionToTest = newExpressionToTest; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST, oldExpressionToTest, newExpressionToTest); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setExpressionToTest(Term newExpressionToTest) |
| { |
| if (newExpressionToTest != expressionToTest) |
| { |
| NotificationChain msgs = null; |
| if (expressionToTest != null) |
| msgs = ((InternalEObject)expressionToTest).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST, null, msgs); |
| if (newExpressionToTest != null) |
| msgs = ((InternalEObject)newExpressionToTest).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST, null, msgs); |
| msgs = basicSetExpressionToTest(newExpressionToTest, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST, newExpressionToTest, newExpressionToTest)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ASMRuleInvocation getRuleTrue() |
| { |
| return ruleTrue; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetRuleTrue(ASMRuleInvocation newRuleTrue, NotificationChain msgs) |
| { |
| ASMRuleInvocation oldRuleTrue = ruleTrue; |
| ruleTrue = newRuleTrue; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE, oldRuleTrue, newRuleTrue); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRuleTrue(ASMRuleInvocation newRuleTrue) |
| { |
| if (newRuleTrue != ruleTrue) |
| { |
| NotificationChain msgs = null; |
| if (ruleTrue != null) |
| msgs = ((InternalEObject)ruleTrue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE, null, msgs); |
| if (newRuleTrue != null) |
| msgs = ((InternalEObject)newRuleTrue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE, null, msgs); |
| msgs = basicSetRuleTrue(newRuleTrue, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE, newRuleTrue, newRuleTrue)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ASMRuleInvocation getRuleFalse() |
| { |
| return ruleFalse; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetRuleFalse(ASMRuleInvocation newRuleFalse, NotificationChain msgs) |
| { |
| ASMRuleInvocation oldRuleFalse = ruleFalse; |
| ruleFalse = newRuleFalse; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE, oldRuleFalse, newRuleFalse); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRuleFalse(ASMRuleInvocation newRuleFalse) |
| { |
| if (newRuleFalse != ruleFalse) |
| { |
| NotificationChain msgs = null; |
| if (ruleFalse != null) |
| msgs = ((InternalEObject)ruleFalse).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE, null, msgs); |
| if (newRuleFalse != null) |
| msgs = ((InternalEObject)newRuleFalse).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE, null, msgs); |
| msgs = basicSetRuleFalse(newRuleFalse, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE, newRuleFalse, newRuleFalse)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST: |
| return basicSetExpressionToTest(null, msgs); |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE: |
| return basicSetRuleTrue(null, msgs); |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE: |
| return basicSetRuleFalse(null, 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.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST: |
| return getExpressionToTest(); |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE: |
| return getRuleTrue(); |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE: |
| return getRuleFalse(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST: |
| setExpressionToTest((Term)newValue); |
| return; |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE: |
| setRuleTrue((ASMRuleInvocation)newValue); |
| return; |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE: |
| setRuleFalse((ASMRuleInvocation)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST: |
| setExpressionToTest((Term)null); |
| return; |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE: |
| setRuleTrue((ASMRuleInvocation)null); |
| return; |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE: |
| setRuleFalse((ASMRuleInvocation)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__EXPRESSION_TO_TEST: |
| return expressionToTest != null; |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_TRUE: |
| return ruleTrue != null; |
| case SimpleRulesPackage.CONDITIONAL_RULE_IF__RULE_FALSE: |
| return ruleFalse != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //ConditionalRuleIfImpl |