blob: 6062adcc723976ab1fbe68e7733d2e8d77346b63 [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.modelmanagement.manipulationRules.update.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.impl.ModelManipulationRuleImpl;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.Term;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.manipulationRules.update.SetRule;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.manipulationRules.update.UpdatePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Set Rule</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.manipulationRules.update.impl.SetRuleImpl#getElement <em>Element</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.manipulationRules.update.impl.SetRuleImpl#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class SetRuleImpl extends ModelManipulationRuleImpl implements SetRule
{
/**
* <!-- 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 #getElement() <em>Element</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getElement()
* @generated
* @ordered
*/
protected Term element;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected Term value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SetRuleImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return UpdatePackage.Literals.SET_RULE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Term getElement()
{
return element;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetElement(Term newElement, NotificationChain msgs)
{
Term oldElement = element;
element = newElement;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UpdatePackage.SET_RULE__ELEMENT, oldElement, newElement);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setElement(Term newElement)
{
if (newElement != element)
{
NotificationChain msgs = null;
if (element != null)
msgs = ((InternalEObject)element).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UpdatePackage.SET_RULE__ELEMENT, null, msgs);
if (newElement != null)
msgs = ((InternalEObject)newElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UpdatePackage.SET_RULE__ELEMENT, null, msgs);
msgs = basicSetElement(newElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UpdatePackage.SET_RULE__ELEMENT, newElement, newElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Term getValue()
{
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetValue(Term newValue, NotificationChain msgs)
{
Term oldValue = value;
value = newValue;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UpdatePackage.SET_RULE__VALUE, oldValue, newValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(Term newValue)
{
if (newValue != value)
{
NotificationChain msgs = null;
if (value != null)
msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UpdatePackage.SET_RULE__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UpdatePackage.SET_RULE__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UpdatePackage.SET_RULE__VALUE, newValue, newValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case UpdatePackage.SET_RULE__ELEMENT:
return basicSetElement(null, msgs);
case UpdatePackage.SET_RULE__VALUE:
return basicSetValue(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 UpdatePackage.SET_RULE__ELEMENT:
return getElement();
case UpdatePackage.SET_RULE__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case UpdatePackage.SET_RULE__ELEMENT:
setElement((Term)newValue);
return;
case UpdatePackage.SET_RULE__VALUE:
setValue((Term)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case UpdatePackage.SET_RULE__ELEMENT:
setElement((Term)null);
return;
case UpdatePackage.SET_RULE__VALUE:
setValue((Term)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case UpdatePackage.SET_RULE__ELEMENT:
return element != null;
case UpdatePackage.SET_RULE__VALUE:
return value != null;
}
return super.eIsSet(featureID);
}
} //SetRuleImpl