blob: f2f8bee1a3314eb2263d1072bf1baff3a0e425e2 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Lunifera GmbH (Wien), Loetz GmbH&Co.KG (Heidelberg)
* 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
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Florian Pirchner - Initial implementation
*
*/
package org.eclipse.osbp.dsl.semantic.common.types.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.osbp.dsl.semantic.common.types.LAnnotationDef;
import org.eclipse.osbp.dsl.semantic.common.types.OSBPTypesPackage;
import org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>LAnnotation Def</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.osbp.dsl.semantic.common.types.impl.LAnnotationDefImpl#isExclude <em>Exclude</em>}</li>
* <li>{@link org.eclipse.osbp.dsl.semantic.common.types.impl.LAnnotationDefImpl#getAnnotation <em>Annotation</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LAnnotationDefImpl extends LLazyResolverImpl implements LAnnotationDef {
/**
* The default value of the '{@link #isExclude() <em>Exclude</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isExclude()
* @generated
* @ordered
*/
protected static final boolean EXCLUDE_EDEFAULT = false;
/**
* The cached value of the '{@link #isExclude() <em>Exclude</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isExclude()
* @generated
* @ordered
*/
protected boolean exclude = EXCLUDE_EDEFAULT;
/**
* The cached value of the '{@link #getAnnotation() <em>Annotation</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnnotation()
* @generated
* @ordered
*/
protected XAnnotation annotation;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LAnnotationDefImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return OSBPTypesPackage.Literals.LANNOTATION_DEF;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isExclude() {
return exclude;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExclude(boolean newExclude) {
boolean oldExclude = exclude;
exclude = newExclude;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LANNOTATION_DEF__EXCLUDE, oldExclude, exclude));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XAnnotation getAnnotation() {
return annotation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAnnotation(XAnnotation newAnnotation, NotificationChain msgs) {
XAnnotation oldAnnotation = annotation;
annotation = newAnnotation;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION, oldAnnotation, newAnnotation);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAnnotation(XAnnotation newAnnotation) {
if (newAnnotation != annotation) {
NotificationChain msgs = null;
if (annotation != null)
msgs = ((InternalEObject)annotation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION, null, msgs);
if (newAnnotation != null)
msgs = ((InternalEObject)newAnnotation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION, null, msgs);
msgs = basicSetAnnotation(newAnnotation, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION, newAnnotation, newAnnotation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION:
return basicSetAnnotation(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 OSBPTypesPackage.LANNOTATION_DEF__EXCLUDE:
return isExclude();
case OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION:
return getAnnotation();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case OSBPTypesPackage.LANNOTATION_DEF__EXCLUDE:
setExclude((Boolean)newValue);
return;
case OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION:
setAnnotation((XAnnotation)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OSBPTypesPackage.LANNOTATION_DEF__EXCLUDE:
setExclude(EXCLUDE_EDEFAULT);
return;
case OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION:
setAnnotation((XAnnotation)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OSBPTypesPackage.LANNOTATION_DEF__EXCLUDE:
return exclude != EXCLUDE_EDEFAULT;
case OSBPTypesPackage.LANNOTATION_DEF__ANNOTATION:
return annotation != null;
}
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(" (exclude: ");
result.append(exclude);
result.append(')');
return result.toString();
}
} //LAnnotationDefImpl