blob: 83eaa0188060808c39f88038bee0ac2c4bc38197 [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.creation.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.asm.terms.VariableReference;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.manipulationRules.creation.CreationPackage;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.manipulationRules.creation.ElementCreateRule;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Element Create Rule</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.manipulationRules.creation.impl.ElementCreateRuleImpl#getType <em>Type</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.manipulationRules.creation.impl.ElementCreateRuleImpl#getTargetVariable <em>Target Variable</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class ElementCreateRuleImpl extends ModelManipulationRuleImpl implements ElementCreateRule
{
/**
* <!-- 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 #getType() <em>Type</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected Term type;
/**
* The cached value of the '{@link #getTargetVariable() <em>Target Variable</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTargetVariable()
* @generated
* @ordered
*/
protected VariableReference targetVariable;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ElementCreateRuleImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return CreationPackage.Literals.ELEMENT_CREATE_RULE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Term getType()
{
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetType(Term newType, NotificationChain msgs)
{
Term oldType = type;
type = newType;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CreationPackage.ELEMENT_CREATE_RULE__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(Term newType)
{
if (newType != type)
{
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CreationPackage.ELEMENT_CREATE_RULE__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CreationPackage.ELEMENT_CREATE_RULE__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CreationPackage.ELEMENT_CREATE_RULE__TYPE, newType, newType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableReference getTargetVariable()
{
return targetVariable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTargetVariable(VariableReference newTargetVariable, NotificationChain msgs)
{
VariableReference oldTargetVariable = targetVariable;
targetVariable = newTargetVariable;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE, oldTargetVariable, newTargetVariable);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTargetVariable(VariableReference newTargetVariable)
{
if (newTargetVariable != targetVariable)
{
NotificationChain msgs = null;
if (targetVariable != null)
msgs = ((InternalEObject)targetVariable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE, null, msgs);
if (newTargetVariable != null)
msgs = ((InternalEObject)newTargetVariable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE, null, msgs);
msgs = basicSetTargetVariable(newTargetVariable, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE, newTargetVariable, newTargetVariable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case CreationPackage.ELEMENT_CREATE_RULE__TYPE:
return basicSetType(null, msgs);
case CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE:
return basicSetTargetVariable(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 CreationPackage.ELEMENT_CREATE_RULE__TYPE:
return getType();
case CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE:
return getTargetVariable();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case CreationPackage.ELEMENT_CREATE_RULE__TYPE:
setType((Term)newValue);
return;
case CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE:
setTargetVariable((VariableReference)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case CreationPackage.ELEMENT_CREATE_RULE__TYPE:
setType((Term)null);
return;
case CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE:
setTargetVariable((VariableReference)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case CreationPackage.ELEMENT_CREATE_RULE__TYPE:
return type != null;
case CreationPackage.ELEMENT_CREATE_RULE__TARGET_VARIABLE:
return targetVariable != null;
}
return super.eIsSet(featureID);
}
} //ElementCreateRuleImpl