/*******************************************************************************
* Copyright (c) 2011-2013 University of Mannheim: Chair for Software Engineering
* 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:
* Ralph Gerbig - initial API and implementation and initial documentation
*******************************************************************************/
package de.uni_mannheim.informatik.swt.models.plm.PLM.impl;
import de.uni_mannheim.informatik.swt.models.plm.PLM.AbstractDSLVisualizer;
import de.uni_mannheim.informatik.swt.models.plm.PLM.Element;
import de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer;
import de.uni_mannheim.informatik.swt.models.plm.PLM.PLMPackage;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>LML Visualizer</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.LMLVisualizerImpl#getAttributes <em>Attributes</em>}</li>
* <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.LMLVisualizerImpl#getDurability <em>Durability</em>}</li>
* <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.LMLVisualizerImpl#getTemplate <em>Template</em>}</li>
* <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.LMLVisualizerImpl#getDslVisualizer <em>Dsl Visualizer</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LMLVisualizerImpl extends MinimalEObjectImpl.Container implements LMLVisualizer {
/**
* The cached value of the '{@link #getAttributes() <em>Attributes</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttributes()
* @generated
* @ordered
*/
protected EList<String> attributes;
/**
* The default value of the '{@link #getDurability() <em>Durability</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDurability()
* @generated
* @ordered
*/
protected static final int DURABILITY_EDEFAULT = 0;
/**
* The cached value of the '{@link #getDurability() <em>Durability</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDurability()
* @generated
* @ordered
*/
protected int durability = DURABILITY_EDEFAULT;
/**
* The cached value of the '{@link #getTemplate() <em>Template</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTemplate()
* @generated
* @ordered
*/
protected LMLVisualizer template;
/**
* The cached value of the '{@link #getDslVisualizer() <em>Dsl Visualizer</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDslVisualizer()
* @generated
* @ordered
*/
protected EList<AbstractDSLVisualizer> dslVisualizer;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LMLVisualizerImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PLMPackage.Literals.LML_VISUALIZER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getAttributes() {
if (attributes == null) {
attributes = new EDataTypeUniqueEList<String>(String.class, this, PLMPackage.LML_VISUALIZER__ATTRIBUTES);
}
return attributes;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getDurability() {
return durability;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDurability(int newDurability) {
int oldDurability = durability;
durability = newDurability;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.LML_VISUALIZER__DURABILITY, oldDurability, durability));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LMLVisualizer getTemplate() {
if (template != null && template.eIsProxy()) {
InternalEObject oldTemplate = (InternalEObject)template;
template = (LMLVisualizer)eResolveProxy(oldTemplate);
if (template != oldTemplate) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PLMPackage.LML_VISUALIZER__TEMPLATE, oldTemplate, template));
}
}
return template;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LMLVisualizer basicGetTemplate() {
return template;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTemplate(LMLVisualizer newTemplate) {
LMLVisualizer oldTemplate = template;
template = newTemplate;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.LML_VISUALIZER__TEMPLATE, oldTemplate, template));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<AbstractDSLVisualizer> getDslVisualizer() {
if (dslVisualizer == null) {
dslVisualizer = new EObjectContainmentEList<AbstractDSLVisualizer>(AbstractDSLVisualizer.class, this, PLMPackage.LML_VISUALIZER__DSL_VISUALIZER);
}
return dslVisualizer;
}
/**
* The cached invocation delegate for the '{@link #getDefaultVisualizationValues() <em>Get Default Visualization Values</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefaultVisualizationValues()
* @generated
* @ordered
*/
protected static final EOperation.Internal.InvocationDelegate GET_DEFAULT_VISUALIZATION_VALUES__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.LML_VISUALIZER___GET_DEFAULT_VISUALIZATION_VALUES).getInvocationDelegate();
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
public EList<String> getDefaultVisualizationValues() {
try {
return (EList<String>)GET_DEFAULT_VISUALIZATION_VALUES__EINVOCATION_DELEGATE.dynamicInvoke(this, null);
}
catch (InvocationTargetException ite) {
throw new WrappedException(ite);
}
}
/**
* The cached invocation delegate for the '{@link #getValueForKey(java.lang.String) <em>Get Value For Key</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValueForKey(java.lang.String)
* @generated
* @ordered
*/
protected static final EOperation.Internal.InvocationDelegate GET_VALUE_FOR_KEY_STRING__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.LML_VISUALIZER___GET_VALUE_FOR_KEY__STRING).getInvocationDelegate();
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getValueForKey(String key) {
try {
return (String)GET_VALUE_FOR_KEY_STRING__EINVOCATION_DELEGATE.dynamicInvoke(this, new BasicEList.UnmodifiableEList<Object>(1, new Object[]{key}));
}
catch (InvocationTargetException ite) {
throw new WrappedException(ite);
}
}
/**
* The cached invocation delegate for the '{@link #getContainingElement() <em>Get Containing Element</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContainingElement()
* @generated
* @ordered
*/
protected static final EOperation.Internal.InvocationDelegate GET_CONTAINING_ELEMENT__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.LML_VISUALIZER___GET_CONTAINING_ELEMENT).getInvocationDelegate();
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Element getContainingElement() {
try {
return (Element)GET_CONTAINING_ELEMENT__EINVOCATION_DELEGATE.dynamicInvoke(this, null);
}
catch (InvocationTargetException ite) {
throw new WrappedException(ite);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void EOperation0() {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PLMPackage.LML_VISUALIZER__DSL_VISUALIZER:
return ((InternalEList<?>)getDslVisualizer()).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 PLMPackage.LML_VISUALIZER__ATTRIBUTES:
return getAttributes();
case PLMPackage.LML_VISUALIZER__DURABILITY:
return getDurability();
case PLMPackage.LML_VISUALIZER__TEMPLATE:
if (resolve) return getTemplate();
return basicGetTemplate();
case PLMPackage.LML_VISUALIZER__DSL_VISUALIZER:
return getDslVisualizer();
}
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 PLMPackage.LML_VISUALIZER__ATTRIBUTES:
getAttributes().clear();
getAttributes().addAll((Collection<? extends String>)newValue);
return;
case PLMPackage.LML_VISUALIZER__DURABILITY:
setDurability((Integer)newValue);
return;
case PLMPackage.LML_VISUALIZER__TEMPLATE:
setTemplate((LMLVisualizer)newValue);
return;
case PLMPackage.LML_VISUALIZER__DSL_VISUALIZER:
getDslVisualizer().clear();
getDslVisualizer().addAll((Collection<? extends AbstractDSLVisualizer>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PLMPackage.LML_VISUALIZER__ATTRIBUTES:
getAttributes().clear();
return;
case PLMPackage.LML_VISUALIZER__DURABILITY:
setDurability(DURABILITY_EDEFAULT);
return;
case PLMPackage.LML_VISUALIZER__TEMPLATE:
setTemplate((LMLVisualizer)null);
return;
case PLMPackage.LML_VISUALIZER__DSL_VISUALIZER:
getDslVisualizer().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PLMPackage.LML_VISUALIZER__ATTRIBUTES:
return attributes != null && !attributes.isEmpty();
case PLMPackage.LML_VISUALIZER__DURABILITY:
return durability != DURABILITY_EDEFAULT;
case PLMPackage.LML_VISUALIZER__TEMPLATE:
return template != null;
case PLMPackage.LML_VISUALIZER__DSL_VISUALIZER:
return dslVisualizer != null && !dslVisualizer.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case PLMPackage.LML_VISUALIZER___GET_DEFAULT_VISUALIZATION_VALUES:
return getDefaultVisualizationValues();
case PLMPackage.LML_VISUALIZER___GET_VALUE_FOR_KEY__STRING:
return getValueForKey((String)arguments.get(0));
case PLMPackage.LML_VISUALIZER___GET_CONTAINING_ELEMENT:
return getContainingElement();
case PLMPackage.LML_VISUALIZER___EOPERATION0:
EOperation0();
return null;
}
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(" (attributes: ");
result.append(attributes);
result.append(", durability: ");
result.append(durability);
result.append(')');
return result.toString();
}
} //LMLVisualizerImpl