/**
* Copyright (c) 2012 Mia-Software.
*
* 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:
* Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
*
*
*/
package org.eclipse.emf.facet.query.ocl.metamodel.oclquery.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.impl.QueryImpl;
import org.eclipse.emf.facet.query.ocl.metamodel.oclquery.OclQuery;
import org.eclipse.emf.facet.query.ocl.metamodel.oclquery.OclQueryPackage;
/**
*
* An implementation of the model object 'Ocl Query'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.emf.facet.query.ocl.metamodel.oclquery.impl.OclQueryImpl#getContext Context}
* - {@link org.eclipse.emf.facet.query.ocl.metamodel.oclquery.impl.OclQueryImpl#getOclExpression Ocl Expression}
*
*
*
* @generated
*/
public class OclQueryImpl extends QueryImpl implements OclQuery {
/**
* The cached value of the '{@link #getContext() Context}' reference.
*
*
* @see #getContext()
* @generated
* @ordered
*/
protected EClassifier context;
/**
* The default value of the '{@link #getOclExpression() Ocl Expression}' attribute.
*
*
* @see #getOclExpression()
* @generated
* @ordered
*/
protected static final String OCL_EXPRESSION_EDEFAULT = null;
/**
* The cached value of the '{@link #getOclExpression() Ocl Expression}' attribute.
*
*
* @see #getOclExpression()
* @generated
* @ordered
*/
protected String oclExpression = OCL_EXPRESSION_EDEFAULT;
/**
*
*
* @generated
*/
protected OclQueryImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return OclQueryPackage.Literals.OCL_QUERY;
}
/**
*
*
* @generated
*/
public EClassifier getContext() {
if (context != null && context.eIsProxy()) {
InternalEObject oldContext = (InternalEObject)context;
context = (EClassifier)eResolveProxy(oldContext);
if (context != oldContext) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, OclQueryPackage.OCL_QUERY__CONTEXT, oldContext, context));
}
}
return context;
}
/**
*
*
* @generated
*/
public EClassifier basicGetContext() {
return context;
}
/**
*
*
* @generated
*/
public void setContext(EClassifier newContext) {
EClassifier oldContext = context;
context = newContext;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OclQueryPackage.OCL_QUERY__CONTEXT, oldContext, context));
}
/**
*
*
* @generated
*/
public String getOclExpression() {
return oclExpression;
}
/**
*
*
* @generated
*/
public void setOclExpression(String newOclExpression) {
String oldOclExpression = oclExpression;
oclExpression = newOclExpression;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OclQueryPackage.OCL_QUERY__OCL_EXPRESSION, oldOclExpression, oclExpression));
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case OclQueryPackage.OCL_QUERY__CONTEXT:
if (resolve) return getContext();
return basicGetContext();
case OclQueryPackage.OCL_QUERY__OCL_EXPRESSION:
return getOclExpression();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case OclQueryPackage.OCL_QUERY__CONTEXT:
setContext((EClassifier)newValue);
return;
case OclQueryPackage.OCL_QUERY__OCL_EXPRESSION:
setOclExpression((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OclQueryPackage.OCL_QUERY__CONTEXT:
setContext((EClassifier)null);
return;
case OclQueryPackage.OCL_QUERY__OCL_EXPRESSION:
setOclExpression(OCL_EXPRESSION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OclQueryPackage.OCL_QUERY__CONTEXT:
return context != null;
case OclQueryPackage.OCL_QUERY__OCL_EXPRESSION:
return OCL_EXPRESSION_EDEFAULT == null ? oclExpression != null : !OCL_EXPRESSION_EDEFAULT.equals(oclExpression);
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
return getOclExpression();
}
} //OclQueryImpl