blob: d533f940c159b6e794ee4fbf514f4793c0b733c4 [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.GTASMElement;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.RuntimeAnnotation;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>GTASM Element</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl.GTASMElementImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl.GTASMElementImpl#getId <em>Id</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl.GTASMElementImpl#getFqn <em>Fqn</em>}</li>
* <li>{@link org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.impl.GTASMElementImpl#getRuntimeAnnotations <em>Runtime Annotations</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class GTASMElementImpl extends AnnotatedElementImpl implements GTASMElement
{
/**
* <!-- 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 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 default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final long ID_EDEFAULT = 0L;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected long id = ID_EDEFAULT;
/**
* The default value of the '{@link #getFqn() <em>Fqn</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFqn()
* @generated
* @ordered
*/
protected static final String FQN_EDEFAULT = null;
/**
* The cached value of the '{@link #getFqn() <em>Fqn</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFqn()
* @generated
* @ordered
*/
protected String fqn = FQN_EDEFAULT;
/**
* The cached value of the '{@link #getRuntimeAnnotations() <em>Runtime Annotations</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRuntimeAnnotations()
* @generated
* @ordered
*/
protected EList<RuntimeAnnotation> runtimeAnnotations;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GTASMElementImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return CorePackage.Literals.GTASM_ELEMENT;
}
/**
* <!-- 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, CorePackage.GTASM_ELEMENT__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public long getId()
{
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(long newId)
{
long oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.GTASM_ELEMENT__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getFqn()
{
return fqn;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFqn(String newFqn)
{
String oldFqn = fqn;
fqn = newFqn;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.GTASM_ELEMENT__FQN, oldFqn, fqn));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<RuntimeAnnotation> getRuntimeAnnotations()
{
if (runtimeAnnotations == null)
{
runtimeAnnotations = new EObjectContainmentEList<RuntimeAnnotation>(RuntimeAnnotation.class, this, CorePackage.GTASM_ELEMENT__RUNTIME_ANNOTATIONS);
}
return runtimeAnnotations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case CorePackage.GTASM_ELEMENT__RUNTIME_ANNOTATIONS:
return ((InternalEList<?>)getRuntimeAnnotations()).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.GTASM_ELEMENT__NAME:
return getName();
case CorePackage.GTASM_ELEMENT__ID:
return getId();
case CorePackage.GTASM_ELEMENT__FQN:
return getFqn();
case CorePackage.GTASM_ELEMENT__RUNTIME_ANNOTATIONS:
return getRuntimeAnnotations();
}
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.GTASM_ELEMENT__NAME:
setName((String)newValue);
return;
case CorePackage.GTASM_ELEMENT__ID:
setId((Long)newValue);
return;
case CorePackage.GTASM_ELEMENT__FQN:
setFqn((String)newValue);
return;
case CorePackage.GTASM_ELEMENT__RUNTIME_ANNOTATIONS:
getRuntimeAnnotations().clear();
getRuntimeAnnotations().addAll((Collection<? extends RuntimeAnnotation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case CorePackage.GTASM_ELEMENT__NAME:
setName(NAME_EDEFAULT);
return;
case CorePackage.GTASM_ELEMENT__ID:
setId(ID_EDEFAULT);
return;
case CorePackage.GTASM_ELEMENT__FQN:
setFqn(FQN_EDEFAULT);
return;
case CorePackage.GTASM_ELEMENT__RUNTIME_ANNOTATIONS:
getRuntimeAnnotations().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case CorePackage.GTASM_ELEMENT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case CorePackage.GTASM_ELEMENT__ID:
return id != ID_EDEFAULT;
case CorePackage.GTASM_ELEMENT__FQN:
return FQN_EDEFAULT == null ? fqn != null : !FQN_EDEFAULT.equals(fqn);
case CorePackage.GTASM_ELEMENT__RUNTIME_ANNOTATIONS:
return runtimeAnnotations != null && !runtimeAnnotations.isEmpty();
}
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(" (name: ");
result.append(name);
result.append(", id: ");
result.append(id);
result.append(", fqn: ");
result.append(fqn);
result.append(')');
return result.toString();
}
} //GTASMElementImpl