blob: 4f95ed69e9222b2d17bd5fcf30ea4080508562d7 [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.definitions.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.definitions.DefinitionsPackage;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.Variable;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.VariableDefinition;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.Term;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Variable Definition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.impl.VariableDefinitionImpl#getVariable <em>Variable</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.impl.VariableDefinitionImpl#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class VariableDefinitionImpl extends GTASMElementImpl implements VariableDefinition
{
/**
* <!-- 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>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVariable()
* @generated
* @ordered
*/
protected Variable variable;
/**
* 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 VariableDefinitionImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DefinitionsPackage.Literals.VARIABLE_DEFINITION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Variable getVariable()
{
if (variable != null && variable.eIsProxy())
{
InternalEObject oldVariable = (InternalEObject)variable;
variable = (Variable)eResolveProxy(oldVariable);
if (variable != oldVariable)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DefinitionsPackage.VARIABLE_DEFINITION__VARIABLE, oldVariable, variable));
}
}
return variable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Variable basicGetVariable()
{
return variable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVariable(Variable newVariable)
{
Variable oldVariable = variable;
variable = newVariable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DefinitionsPackage.VARIABLE_DEFINITION__VARIABLE, oldVariable, variable));
}
/**
* <!-- 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, DefinitionsPackage.VARIABLE_DEFINITION__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 - DefinitionsPackage.VARIABLE_DEFINITION__VALUE, null, msgs);
if (newValue != null)
msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DefinitionsPackage.VARIABLE_DEFINITION__VALUE, null, msgs);
msgs = basicSetValue(newValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DefinitionsPackage.VARIABLE_DEFINITION__VALUE, newValue, newValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case DefinitionsPackage.VARIABLE_DEFINITION__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 DefinitionsPackage.VARIABLE_DEFINITION__VARIABLE:
if (resolve) return getVariable();
return basicGetVariable();
case DefinitionsPackage.VARIABLE_DEFINITION__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 DefinitionsPackage.VARIABLE_DEFINITION__VARIABLE:
setVariable((Variable)newValue);
return;
case DefinitionsPackage.VARIABLE_DEFINITION__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 DefinitionsPackage.VARIABLE_DEFINITION__VARIABLE:
setVariable((Variable)null);
return;
case DefinitionsPackage.VARIABLE_DEFINITION__VALUE:
setValue((Term)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DefinitionsPackage.VARIABLE_DEFINITION__VARIABLE:
return variable != null;
case DefinitionsPackage.VARIABLE_DEFINITION__VALUE:
return value != null;
}
return super.eIsSet(featureID);
}
} //VariableDefinitionImpl