blob: 324f00d7a3702d9c1bb2d834491e387b1c1353d0 [file] [log] [blame]
/**
* * 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.ConditionalRuleTry;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.SimpleRulesPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Conditional Rule Try</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.impl.ConditionalRuleTryImpl#getRuleToTry <em>Rule To Try</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.impl.ConditionalRuleTryImpl#getRuleElse <em>Rule Else</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConditionalRuleTryImpl extends ASMRuleInvocationImpl implements ConditionalRuleTry
{
/**
* <!-- 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 #getRuleToTry() <em>Rule To Try</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRuleToTry()
* @generated
* @ordered
*/
protected ASMRuleInvocation ruleToTry;
/**
* The cached value of the '{@link #getRuleElse() <em>Rule Else</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRuleElse()
* @generated
* @ordered
*/
protected ASMRuleInvocation ruleElse;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConditionalRuleTryImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SimpleRulesPackage.Literals.CONDITIONAL_RULE_TRY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ASMRuleInvocation getRuleToTry()
{
return ruleToTry;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRuleToTry(ASMRuleInvocation newRuleToTry, NotificationChain msgs)
{
ASMRuleInvocation oldRuleToTry = ruleToTry;
ruleToTry = newRuleToTry;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_TO_TRY, oldRuleToTry, newRuleToTry);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRuleToTry(ASMRuleInvocation newRuleToTry)
{
if (newRuleToTry != ruleToTry)
{
NotificationChain msgs = null;
if (ruleToTry != null)
msgs = ((InternalEObject)ruleToTry).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_TO_TRY, null, msgs);
if (newRuleToTry != null)
msgs = ((InternalEObject)newRuleToTry).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_TO_TRY, null, msgs);
msgs = basicSetRuleToTry(newRuleToTry, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_TO_TRY, newRuleToTry, newRuleToTry));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ASMRuleInvocation getRuleElse()
{
return ruleElse;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRuleElse(ASMRuleInvocation newRuleElse, NotificationChain msgs)
{
ASMRuleInvocation oldRuleElse = ruleElse;
ruleElse = newRuleElse;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE, oldRuleElse, newRuleElse);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRuleElse(ASMRuleInvocation newRuleElse)
{
if (newRuleElse != ruleElse)
{
NotificationChain msgs = null;
if (ruleElse != null)
msgs = ((InternalEObject)ruleElse).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE, null, msgs);
if (newRuleElse != null)
msgs = ((InternalEObject)newRuleElse).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE, null, msgs);
msgs = basicSetRuleElse(newRuleElse, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE, newRuleElse, newRuleElse));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_TO_TRY:
return basicSetRuleToTry(null, msgs);
case SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE:
return basicSetRuleElse(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_TRY__RULE_TO_TRY:
return getRuleToTry();
case SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE:
return getRuleElse();
}
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_TRY__RULE_TO_TRY:
setRuleToTry((ASMRuleInvocation)newValue);
return;
case SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE:
setRuleElse((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_TRY__RULE_TO_TRY:
setRuleToTry((ASMRuleInvocation)null);
return;
case SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE:
setRuleElse((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_TRY__RULE_TO_TRY:
return ruleToTry != null;
case SimpleRulesPackage.CONDITIONAL_RULE_TRY__RULE_ELSE:
return ruleElse != null;
}
return super.eIsSet(featureID);
}
} //ConditionalRuleTryImpl