blob: a8c833d4bf20f35c81ac6e6e131d2f8eb2c3a0c9 [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.gt.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.core.impl.GTASMElementImpl;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.VariableReference;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.GtPackage;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.PatternVariableConstraint;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Pattern Variable Constraint</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.impl.PatternVariableConstraintImpl#getLeftValue <em>Left Value</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.impl.PatternVariableConstraintImpl#getRightValue <em>Right Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class PatternVariableConstraintImpl extends GTASMElementImpl implements PatternVariableConstraint
{
/**
* <!-- 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 #getLeftValue() <em>Left Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeftValue()
* @generated
* @ordered
*/
protected VariableReference leftValue;
/**
* The cached value of the '{@link #getRightValue() <em>Right Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRightValue()
* @generated
* @ordered
*/
protected VariableReference rightValue;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PatternVariableConstraintImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return GtPackage.Literals.PATTERN_VARIABLE_CONSTRAINT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableReference getLeftValue()
{
return leftValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeftValue(VariableReference newLeftValue, NotificationChain msgs)
{
VariableReference oldLeftValue = leftValue;
leftValue = newLeftValue;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE, oldLeftValue, newLeftValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLeftValue(VariableReference newLeftValue)
{
if (newLeftValue != leftValue)
{
NotificationChain msgs = null;
if (leftValue != null)
msgs = ((InternalEObject)leftValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE, null, msgs);
if (newLeftValue != null)
msgs = ((InternalEObject)newLeftValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE, null, msgs);
msgs = basicSetLeftValue(newLeftValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE, newLeftValue, newLeftValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableReference getRightValue()
{
return rightValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRightValue(VariableReference newRightValue, NotificationChain msgs)
{
VariableReference oldRightValue = rightValue;
rightValue = newRightValue;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE, oldRightValue, newRightValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRightValue(VariableReference newRightValue)
{
if (newRightValue != rightValue)
{
NotificationChain msgs = null;
if (rightValue != null)
msgs = ((InternalEObject)rightValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE, null, msgs);
if (newRightValue != null)
msgs = ((InternalEObject)newRightValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE, null, msgs);
msgs = basicSetRightValue(newRightValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE, newRightValue, newRightValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE:
return basicSetLeftValue(null, msgs);
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE:
return basicSetRightValue(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 GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE:
return getLeftValue();
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE:
return getRightValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE:
setLeftValue((VariableReference)newValue);
return;
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE:
setRightValue((VariableReference)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE:
setLeftValue((VariableReference)null);
return;
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE:
setRightValue((VariableReference)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__LEFT_VALUE:
return leftValue != null;
case GtPackage.PATTERN_VARIABLE_CONSTRAINT__RIGHT_VALUE:
return rightValue != null;
}
return super.eIsSet(featureID);
}
} //PatternVariableConstraintImpl