blob: 06b90297a102e050de9e9b948fff0b5c52179404 [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.RuleUpdateVariable;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.SimpleRulesPackage;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.VariableReference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Rule Update Variable</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.simpleRules.impl.RuleUpdateVariableImpl#getVariable <em>Variable</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class RuleUpdateVariableImpl extends RuleUpdateImpl implements RuleUpdateVariable
{
/**
* <!-- 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 #getVariable() <em>Variable</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVariable()
* @generated
* @ordered
*/
protected VariableReference variable;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RuleUpdateVariableImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SimpleRulesPackage.Literals.RULE_UPDATE_VARIABLE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableReference getVariable()
{
return variable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetVariable(VariableReference newVariable, NotificationChain msgs)
{
VariableReference oldVariable = variable;
variable = newVariable;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.RULE_UPDATE_VARIABLE__VARIABLE, oldVariable, newVariable);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVariable(VariableReference newVariable)
{
if (newVariable != variable)
{
NotificationChain msgs = null;
if (variable != null)
msgs = ((InternalEObject)variable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.RULE_UPDATE_VARIABLE__VARIABLE, null, msgs);
if (newVariable != null)
msgs = ((InternalEObject)newVariable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SimpleRulesPackage.RULE_UPDATE_VARIABLE__VARIABLE, null, msgs);
msgs = basicSetVariable(newVariable, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SimpleRulesPackage.RULE_UPDATE_VARIABLE__VARIABLE, newVariable, newVariable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SimpleRulesPackage.RULE_UPDATE_VARIABLE__VARIABLE:
return basicSetVariable(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.RULE_UPDATE_VARIABLE__VARIABLE:
return getVariable();
}
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.RULE_UPDATE_VARIABLE__VARIABLE:
setVariable((VariableReference)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SimpleRulesPackage.RULE_UPDATE_VARIABLE__VARIABLE:
setVariable((VariableReference)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SimpleRulesPackage.RULE_UPDATE_VARIABLE__VARIABLE:
return variable != null;
}
return super.eIsSet(featureID);
}
} //RuleUpdateVariableImpl