/** | |
* Copyright (c) 2009 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: | |
* Frederic Madiot (Mia-Software) - meta-model design | |
* Gregoire DUPE (Mia-Software) - design and implementation | |
* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.gmt.modisco.infra.query.runtime.impl; | |
import org.eclipse.emf.common.notify.Notification; | |
import org.eclipse.emf.ecore.EClass; | |
import org.eclipse.emf.ecore.EObject; | |
import org.eclipse.emf.ecore.InternalEObject; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
import org.eclipse.emf.ecore.impl.EObjectImpl; | |
import org.eclipse.gmt.modisco.infra.query.runtime.ModelQueryResult; | |
import org.eclipse.gmt.modisco.infra.query.runtime.RuntimePackage; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Model Query Result</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.gmt.modisco.infra.query.runtime.impl.ModelQueryResultImpl#getSource <em>Source</em>}</li> | |
* <li>{@link org.eclipse.gmt.modisco.infra.query.runtime.impl.ModelQueryResultImpl#getValue <em>Value</em>}</li> | |
* <li>{@link org.eclipse.gmt.modisco.infra.query.runtime.impl.ModelQueryResultImpl#getException <em>Exception</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class ModelQueryResultImpl extends EObjectImpl implements ModelQueryResult { | |
/** | |
* The cached value of the '{@link #getSource() <em>Source</em>}' reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getSource() | |
* @generated | |
* @ordered | |
*/ | |
protected EObject source; | |
/** | |
* The default value of the '{@link #getValue() <em>Value</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getValue() | |
* @generated | |
* @ordered | |
*/ | |
protected static final Object VALUE_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getValue() | |
* @generated | |
* @ordered | |
*/ | |
protected Object value = VALUE_EDEFAULT; | |
/** | |
* The default value of the '{@link #getException() <em>Exception</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getException() | |
* @generated | |
* @ordered | |
*/ | |
protected static final Exception EXCEPTION_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getException() <em>Exception</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getException() | |
* @generated | |
* @ordered | |
*/ | |
protected Exception exception = EXCEPTION_EDEFAULT; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected ModelQueryResultImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return RuntimePackage.Literals.MODEL_QUERY_RESULT; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EObject getSource() { | |
if (source != null && source.eIsProxy()) { | |
InternalEObject oldSource = (InternalEObject)source; | |
source = eResolveProxy(oldSource); | |
if (source != oldSource) { | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.MODEL_QUERY_RESULT__SOURCE, oldSource, source)); | |
} | |
} | |
return source; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EObject basicGetSource() { | |
return source; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setSource(EObject newSource) { | |
EObject oldSource = source; | |
source = newSource; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.MODEL_QUERY_RESULT__SOURCE, oldSource, source)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Object getValue() { | |
return value; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setValue(Object newValue) { | |
Object oldValue = value; | |
value = newValue; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.MODEL_QUERY_RESULT__VALUE, oldValue, value)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Exception getException() { | |
return exception; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setException(Exception newException) { | |
Exception oldException = exception; | |
exception = newException; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.MODEL_QUERY_RESULT__EXCEPTION, oldException, exception)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case RuntimePackage.MODEL_QUERY_RESULT__SOURCE: | |
if (resolve) return getSource(); | |
return basicGetSource(); | |
case RuntimePackage.MODEL_QUERY_RESULT__VALUE: | |
return getValue(); | |
case RuntimePackage.MODEL_QUERY_RESULT__EXCEPTION: | |
return getException(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case RuntimePackage.MODEL_QUERY_RESULT__SOURCE: | |
setSource((EObject)newValue); | |
return; | |
case RuntimePackage.MODEL_QUERY_RESULT__VALUE: | |
setValue(newValue); | |
return; | |
case RuntimePackage.MODEL_QUERY_RESULT__EXCEPTION: | |
setException((Exception)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case RuntimePackage.MODEL_QUERY_RESULT__SOURCE: | |
setSource((EObject)null); | |
return; | |
case RuntimePackage.MODEL_QUERY_RESULT__VALUE: | |
setValue(VALUE_EDEFAULT); | |
return; | |
case RuntimePackage.MODEL_QUERY_RESULT__EXCEPTION: | |
setException(EXCEPTION_EDEFAULT); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case RuntimePackage.MODEL_QUERY_RESULT__SOURCE: | |
return source != null; | |
case RuntimePackage.MODEL_QUERY_RESULT__VALUE: | |
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); | |
case RuntimePackage.MODEL_QUERY_RESULT__EXCEPTION: | |
return EXCEPTION_EDEFAULT == null ? exception != null : !EXCEPTION_EDEFAULT.equals(exception); | |
} | |
return super.eIsSet(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public String toString() { | |
if (eIsProxy()) return super.toString(); | |
StringBuffer result = new StringBuffer(super.toString()); | |
result.append(" (value: "); //$NON-NLS-1$ | |
result.append(value); | |
result.append(", exception: "); //$NON-NLS-1$ | |
result.append(exception); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //ModelQueryResultImpl |