blob: 87cb46b5d77b5ff0130641e2affdcc708c7fa181 [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 java.lang.reflect.InvocationTargetException;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
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.LAnnotationTarget;
import org.eclipse.osbp.dsl.semantic.common.types.LType;
import org.eclipse.osbp.dsl.semantic.common.types.OSBPTypesPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>LType</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.dsl.semantic.common.types.impl.LTypeImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.osbp.dsl.semantic.common.types.impl.LTypeImpl#getAnnotationInfo <em>Annotation Info</em>}</li>
* </ul>
*
* @generated
*/
public class LTypeImpl extends LAnnotationTargetImpl implements LType {
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getAnnotationInfo() <em>Annotation Info</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnnotationInfo()
* @generated
* @ordered
*/
protected LAnnotationTarget annotationInfo;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return OSBPTypesPackage.Literals.LTYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LTYPE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LAnnotationTarget getAnnotationInfo() {
return annotationInfo;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAnnotationInfo(LAnnotationTarget newAnnotationInfo, NotificationChain msgs) {
LAnnotationTarget oldAnnotationInfo = annotationInfo;
annotationInfo = newAnnotationInfo;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LTYPE__ANNOTATION_INFO, oldAnnotationInfo, newAnnotationInfo);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAnnotationInfo(LAnnotationTarget newAnnotationInfo) {
if (newAnnotationInfo != annotationInfo) {
NotificationChain msgs = null;
if (annotationInfo != null)
msgs = ((InternalEObject)annotationInfo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OSBPTypesPackage.LTYPE__ANNOTATION_INFO, null, msgs);
if (newAnnotationInfo != null)
msgs = ((InternalEObject)newAnnotationInfo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OSBPTypesPackage.LTYPE__ANNOTATION_INFO, null, msgs);
msgs = basicSetAnnotationInfo(newAnnotationInfo, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OSBPTypesPackage.LTYPE__ANNOTATION_INFO, newAnnotationInfo, newAnnotationInfo));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<LAnnotationDef> getResolvedAnnotations() {
EList<LAnnotationDef> _xifexpression = null;
LAnnotationTarget _annotationInfo = this.getAnnotationInfo();
boolean _tripleNotEquals = (_annotationInfo != null);
if (_tripleNotEquals) {
_xifexpression = this.getAnnotationInfo().getAnnotations();
}
else {
_xifexpression = this.getAnnotations();
}
return _xifexpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case OSBPTypesPackage.LTYPE__ANNOTATION_INFO:
return basicSetAnnotationInfo(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.LTYPE__NAME:
return getName();
case OSBPTypesPackage.LTYPE__ANNOTATION_INFO:
return getAnnotationInfo();
}
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.LTYPE__NAME:
setName((String)newValue);
return;
case OSBPTypesPackage.LTYPE__ANNOTATION_INFO:
setAnnotationInfo((LAnnotationTarget)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OSBPTypesPackage.LTYPE__NAME:
setName(NAME_EDEFAULT);
return;
case OSBPTypesPackage.LTYPE__ANNOTATION_INFO:
setAnnotationInfo((LAnnotationTarget)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OSBPTypesPackage.LTYPE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case OSBPTypesPackage.LTYPE__ANNOTATION_INFO:
return annotationInfo != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case OSBPTypesPackage.LTYPE___GET_RESOLVED_ANNOTATIONS:
return getResolvedAnnotations();
}
return super.eInvoke(operationID, arguments);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //LTypeImpl