blob: 33a6f13e5959a76bb160d7108d43af5ac9ece048 [file] [log] [blame]
/**
* * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro
* * 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:
* * Istvan Rath, Daniel Varro - initial API and implementation
*
*/
package org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl;
import java.util.Collection;
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.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.CorePackage;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.RuntimeAnnotation;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.RuntimeAnnotationElement;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Runtime Annotation</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl.RuntimeAnnotationImpl#getElements <em>Elements</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl.RuntimeAnnotationImpl#getAnnotationName <em>Annotation Name</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class RuntimeAnnotationImpl extends AnnotatedElementImpl implements RuntimeAnnotation
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = " * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors:\r\n * Istvan Rath, Daniel Varro - initial API and implementation\r\n";
/**
* The cached value of the '{@link #getElements() <em>Elements</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getElements()
* @generated
* @ordered
*/
protected EList<RuntimeAnnotationElement> elements;
/**
* The default value of the '{@link #getAnnotationName() <em>Annotation Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnnotationName()
* @generated
* @ordered
*/
protected static final String ANNOTATION_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getAnnotationName() <em>Annotation Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnnotationName()
* @generated
* @ordered
*/
protected String annotationName = ANNOTATION_NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RuntimeAnnotationImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return CorePackage.Literals.RUNTIME_ANNOTATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<RuntimeAnnotationElement> getElements()
{
if (elements == null)
{
elements = new EObjectContainmentEList<RuntimeAnnotationElement>(RuntimeAnnotationElement.class, this, CorePackage.RUNTIME_ANNOTATION__ELEMENTS);
}
return elements;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAnnotationName()
{
return annotationName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAnnotationName(String newAnnotationName)
{
String oldAnnotationName = annotationName;
annotationName = newAnnotationName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.RUNTIME_ANNOTATION__ANNOTATION_NAME, oldAnnotationName, annotationName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case CorePackage.RUNTIME_ANNOTATION__ELEMENTS:
return ((InternalEList<?>)getElements()).basicRemove(otherEnd, 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 CorePackage.RUNTIME_ANNOTATION__ELEMENTS:
return getElements();
case CorePackage.RUNTIME_ANNOTATION__ANNOTATION_NAME:
return getAnnotationName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case CorePackage.RUNTIME_ANNOTATION__ELEMENTS:
getElements().clear();
getElements().addAll((Collection<? extends RuntimeAnnotationElement>)newValue);
return;
case CorePackage.RUNTIME_ANNOTATION__ANNOTATION_NAME:
setAnnotationName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case CorePackage.RUNTIME_ANNOTATION__ELEMENTS:
getElements().clear();
return;
case CorePackage.RUNTIME_ANNOTATION__ANNOTATION_NAME:
setAnnotationName(ANNOTATION_NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case CorePackage.RUNTIME_ANNOTATION__ELEMENTS:
return elements != null && !elements.isEmpty();
case CorePackage.RUNTIME_ANNOTATION__ANNOTATION_NAME:
return ANNOTATION_NAME_EDEFAULT == null ? annotationName != null : !ANNOTATION_NAME_EDEFAULT.equals(annotationName);
}
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(" (annotationName: ");
result.append(annotationName);
result.append(')');
return result.toString();
}
} //RuntimeAnnotationImpl