/**
* Copyright (c) 2012 BMW Car IT and others.
* 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
*/
package org.jnario.suite.suite.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.jnario.Specification;
import org.jnario.suite.suite.SpecReference;
import org.jnario.suite.suite.SuitePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Spec Reference</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.jnario.suite.suite.impl.SpecReferenceImpl#getSpec <em>Spec</em>}</li>
* <li>{@link org.jnario.suite.suite.impl.SpecReferenceImpl#getText <em>Text</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class SpecReferenceImpl extends MinimalEObjectImpl.Container implements SpecReference
{
/**
* The cached value of the '{@link #getSpec() <em>Spec</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSpec()
* @generated
* @ordered
*/
protected Specification spec;
/**
* The default value of the '{@link #getText() <em>Text</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getText()
* @generated
* @ordered
*/
protected static final String TEXT_EDEFAULT = null;
/**
* The cached value of the '{@link #getText() <em>Text</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getText()
* @generated
* @ordered
*/
protected String text = TEXT_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SpecReferenceImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SuitePackage.Literals.SPEC_REFERENCE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Specification getSpec()
{
if (spec != null && spec.eIsProxy())
{
InternalEObject oldSpec = (InternalEObject)spec;
spec = (Specification)eResolveProxy(oldSpec);
if (spec != oldSpec)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, SuitePackage.SPEC_REFERENCE__SPEC, oldSpec, spec));
}
}
return spec;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Specification basicGetSpec()
{
return spec;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSpec(Specification newSpec)
{
Specification oldSpec = spec;
spec = newSpec;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SuitePackage.SPEC_REFERENCE__SPEC, oldSpec, spec));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getText()
{
return text;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setText(String newText)
{
String oldText = text;
text = newText;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SuitePackage.SPEC_REFERENCE__TEXT, oldText, text));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SuitePackage.SPEC_REFERENCE__SPEC:
if (resolve) return getSpec();
return basicGetSpec();
case SuitePackage.SPEC_REFERENCE__TEXT:
return getText();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SuitePackage.SPEC_REFERENCE__SPEC:
setSpec((Specification)newValue);
return;
case SuitePackage.SPEC_REFERENCE__TEXT:
setText((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SuitePackage.SPEC_REFERENCE__SPEC:
setSpec((Specification)null);
return;
case SuitePackage.SPEC_REFERENCE__TEXT:
setText(TEXT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SuitePackage.SPEC_REFERENCE__SPEC:
return spec != null;
case SuitePackage.SPEC_REFERENCE__TEXT:
return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text);
}
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(" (text: ");
result.append(text);
result.append(')');
return result.toString();
}
} //SpecReferenceImpl