/******************************************************************************* * 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.Clabject; import de.uni_mannheim.informatik.swt.models.plm.PLM.Connection; import de.uni_mannheim.informatik.swt.models.plm.PLM.PLMPackage; import de.uni_mannheim.informatik.swt.models.plm.PLM.Participation; 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.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.EcoreUtil; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Participation</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.ParticipationImpl#getLower <em>Lower</em>}</li> * <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.ParticipationImpl#getUpper <em>Upper</em>}</li> * <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.ParticipationImpl#isNavigable <em>Navigable</em>}</li> * <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.ParticipationImpl#getDestination <em>Destination</em>}</li> * <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.ParticipationImpl#getConnection <em>Connection</em>}</li> * <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.ParticipationImpl#getExpressedParticipationName <em>Expressed Participation Name</em>}</li> * <li>{@link de.uni_mannheim.informatik.swt.models.plm.PLM.impl.ParticipationImpl#isContainment <em>Containment</em>}</li> * </ul> * </p> * * @generated */ public class ParticipationImpl extends MinimalEObjectImpl.Container implements Participation { /** * The default value of the '{@link #getLower() <em>Lower</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLower() * @generated * @ordered */ protected static final Integer LOWER_EDEFAULT = new Integer(0); /** * The cached value of the '{@link #getLower() <em>Lower</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLower() * @generated * @ordered */ protected Integer lower = LOWER_EDEFAULT; /** * The default value of the '{@link #getUpper() <em>Upper</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getUpper() * @generated * @ordered */ protected static final Integer UPPER_EDEFAULT = new Integer(-1); /** * The cached value of the '{@link #getUpper() <em>Upper</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getUpper() * @generated * @ordered */ protected Integer upper = UPPER_EDEFAULT; /** * The default value of the '{@link #isNavigable() <em>Navigable</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isNavigable() * @generated * @ordered */ protected static final boolean NAVIGABLE_EDEFAULT = true; /** * The cached value of the '{@link #isNavigable() <em>Navigable</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isNavigable() * @generated * @ordered */ protected boolean navigable = NAVIGABLE_EDEFAULT; /** * The cached value of the '{@link #getDestination() <em>Destination</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDestination() * @generated * @ordered */ protected Clabject destination; /** * The default value of the '{@link #getExpressedParticipationName() <em>Expressed Participation Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExpressedParticipationName() * @generated * @ordered */ protected static final String EXPRESSED_PARTICIPATION_NAME_EDEFAULT = null; /** * The cached value of the '{@link #getExpressedParticipationName() <em>Expressed Participation Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExpressedParticipationName() * @generated * @ordered */ protected String expressedParticipationName = EXPRESSED_PARTICIPATION_NAME_EDEFAULT; /** * The default value of the '{@link #isContainment() <em>Containment</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isContainment() * @generated * @ordered */ protected static final boolean CONTAINMENT_EDEFAULT = false; /** * The cached value of the '{@link #isContainment() <em>Containment</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isContainment() * @generated * @ordered */ protected boolean containment = CONTAINMENT_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ParticipationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return PLMPackage.Literals.PARTICIPATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Integer getLower() { return lower; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLower(Integer newLower) { Integer oldLower = lower; lower = newLower; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.PARTICIPATION__LOWER, oldLower, lower)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Integer getUpper() { return upper; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setUpper(Integer newUpper) { Integer oldUpper = upper; upper = newUpper; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.PARTICIPATION__UPPER, oldUpper, upper)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isNavigable() { return navigable; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setNavigable(boolean newNavigable) { boolean oldNavigable = navigable; navigable = newNavigable; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.PARTICIPATION__NAVIGABLE, oldNavigable, navigable)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Clabject getDestination() { if (destination != null && destination.eIsProxy()) { InternalEObject oldDestination = (InternalEObject)destination; destination = (Clabject)eResolveProxy(oldDestination); if (destination != oldDestination) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, PLMPackage.PARTICIPATION__DESTINATION, oldDestination, destination)); } } return destination; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Clabject basicGetDestination() { return destination; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDestination(Clabject newDestination) { Clabject oldDestination = destination; destination = newDestination; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.PARTICIPATION__DESTINATION, oldDestination, destination)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Connection getConnection() { if (eContainerFeatureID() != PLMPackage.PARTICIPATION__CONNECTION) return null; return (Connection)eInternalContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetConnection(Connection newConnection, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newConnection, PLMPackage.PARTICIPATION__CONNECTION, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setConnection(Connection newConnection) { if (newConnection != eInternalContainer() || (eContainerFeatureID() != PLMPackage.PARTICIPATION__CONNECTION && newConnection != null)) { if (EcoreUtil.isAncestor(this, newConnection)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newConnection != null) msgs = ((InternalEObject)newConnection).eInverseAdd(this, PLMPackage.CONNECTION__PARTICIPATION, Connection.class, msgs); msgs = basicSetConnection(newConnection, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.PARTICIPATION__CONNECTION, newConnection, newConnection)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getExpressedParticipationName() { return expressedParticipationName; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setExpressedParticipationName(String newExpressedParticipationName) { String oldExpressedParticipationName = expressedParticipationName; expressedParticipationName = newExpressedParticipationName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.PARTICIPATION__EXPRESSED_PARTICIPATION_NAME, oldExpressedParticipationName, expressedParticipationName)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isContainment() { return containment; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setContainment(boolean newContainment) { boolean oldContainment = containment; containment = newContainment; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PLMPackage.PARTICIPATION__CONTAINMENT, oldContainment, containment)); } /** * The cached invocation delegate for the '{@link #getHumanReadableParticipationName() <em>Get Human Readable Participation Name</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getHumanReadableParticipationName() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate GET_HUMAN_READABLE_PARTICIPATION_NAME__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.PARTICIPATION___GET_HUMAN_READABLE_PARTICIPATION_NAME).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getHumanReadableParticipationName() { try { return (String)GET_HUMAN_READABLE_PARTICIPATION_NAME__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #hasDefaultParticipationName() <em>Has Default Participation Name</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #hasDefaultParticipationName() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate HAS_DEFAULT_PARTICIPATION_NAME__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.PARTICIPATION___HAS_DEFAULT_PARTICIPATION_NAME).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean hasDefaultParticipationName() { try { return (Boolean)HAS_DEFAULT_PARTICIPATION_NAME__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #represent() <em>Represent</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #represent() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate REPRESENT__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.PARTICIPATION___REPRESENT).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String represent() { try { return (String)REPRESENT__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #participationName() <em>Participation Name</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #participationName() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate PARTICIPATION_NAME__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.PARTICIPATION___PARTICIPATION_NAME).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String participationName() { try { return (String)PARTICIPATION_NAME__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #representMultiplicity() <em>Represent Multiplicity</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #representMultiplicity() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate REPRESENT_MULTIPLICITY__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.PARTICIPATION___REPRESENT_MULTIPLICITY).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String representMultiplicity() { try { return (String)REPRESENT_MULTIPLICITY__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #getName() <em>Get Name</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate GET_NAME__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.PARTICIPATION___GET_NAME).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { try { return (String)GET_NAME__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * The cached invocation delegate for the '{@link #conforms(de.uni_mannheim.informatik.swt.models.plm.PLM.Participation) <em>Conforms</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #conforms(de.uni_mannheim.informatik.swt.models.plm.PLM.Participation) * @generated * @ordered */ protected static final EOperation.Internal.InvocationDelegate CONFORMS_PARTICIPATION__EINVOCATION_DELEGATE = ((EOperation.Internal)PLMPackage.Literals.PARTICIPATION___CONFORMS__PARTICIPATION).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean conforms(Participation participation) { try { return (Boolean)CONFORMS_PARTICIPATION__EINVOCATION_DELEGATE.dynamicInvoke(this, new BasicEList.UnmodifiableEList<Object>(1, new Object[]{participation})); } catch (InvocationTargetException ite) { throw new WrappedException(ite); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case PLMPackage.PARTICIPATION__CONNECTION: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetConnection((Connection)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case PLMPackage.PARTICIPATION__CONNECTION: return basicSetConnection(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case PLMPackage.PARTICIPATION__CONNECTION: return eInternalContainer().eInverseRemove(this, PLMPackage.CONNECTION__PARTICIPATION, Connection.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case PLMPackage.PARTICIPATION__LOWER: return getLower(); case PLMPackage.PARTICIPATION__UPPER: return getUpper(); case PLMPackage.PARTICIPATION__NAVIGABLE: return isNavigable(); case PLMPackage.PARTICIPATION__DESTINATION: if (resolve) return getDestination(); return basicGetDestination(); case PLMPackage.PARTICIPATION__CONNECTION: return getConnection(); case PLMPackage.PARTICIPATION__EXPRESSED_PARTICIPATION_NAME: return getExpressedParticipationName(); case PLMPackage.PARTICIPATION__CONTAINMENT: return isContainment(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case PLMPackage.PARTICIPATION__LOWER: setLower((Integer)newValue); return; case PLMPackage.PARTICIPATION__UPPER: setUpper((Integer)newValue); return; case PLMPackage.PARTICIPATION__NAVIGABLE: setNavigable((Boolean)newValue); return; case PLMPackage.PARTICIPATION__DESTINATION: setDestination((Clabject)newValue); return; case PLMPackage.PARTICIPATION__CONNECTION: setConnection((Connection)newValue); return; case PLMPackage.PARTICIPATION__EXPRESSED_PARTICIPATION_NAME: setExpressedParticipationName((String)newValue); return; case PLMPackage.PARTICIPATION__CONTAINMENT: setContainment((Boolean)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case PLMPackage.PARTICIPATION__LOWER: setLower(LOWER_EDEFAULT); return; case PLMPackage.PARTICIPATION__UPPER: setUpper(UPPER_EDEFAULT); return; case PLMPackage.PARTICIPATION__NAVIGABLE: setNavigable(NAVIGABLE_EDEFAULT); return; case PLMPackage.PARTICIPATION__DESTINATION: setDestination((Clabject)null); return; case PLMPackage.PARTICIPATION__CONNECTION: setConnection((Connection)null); return; case PLMPackage.PARTICIPATION__EXPRESSED_PARTICIPATION_NAME: setExpressedParticipationName(EXPRESSED_PARTICIPATION_NAME_EDEFAULT); return; case PLMPackage.PARTICIPATION__CONTAINMENT: setContainment(CONTAINMENT_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case PLMPackage.PARTICIPATION__LOWER: return LOWER_EDEFAULT == null ? lower != null : !LOWER_EDEFAULT.equals(lower); case PLMPackage.PARTICIPATION__UPPER: return UPPER_EDEFAULT == null ? upper != null : !UPPER_EDEFAULT.equals(upper); case PLMPackage.PARTICIPATION__NAVIGABLE: return navigable != NAVIGABLE_EDEFAULT; case PLMPackage.PARTICIPATION__DESTINATION: return destination != null; case PLMPackage.PARTICIPATION__CONNECTION: return getConnection() != null; case PLMPackage.PARTICIPATION__EXPRESSED_PARTICIPATION_NAME: return EXPRESSED_PARTICIPATION_NAME_EDEFAULT == null ? expressedParticipationName != null : !EXPRESSED_PARTICIPATION_NAME_EDEFAULT.equals(expressedParticipationName); case PLMPackage.PARTICIPATION__CONTAINMENT: return containment != CONTAINMENT_EDEFAULT; } 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.PARTICIPATION___GET_HUMAN_READABLE_PARTICIPATION_NAME: return getHumanReadableParticipationName(); case PLMPackage.PARTICIPATION___HAS_DEFAULT_PARTICIPATION_NAME: return hasDefaultParticipationName(); case PLMPackage.PARTICIPATION___REPRESENT: return represent(); case PLMPackage.PARTICIPATION___PARTICIPATION_NAME: return participationName(); case PLMPackage.PARTICIPATION___REPRESENT_MULTIPLICITY: return representMultiplicity(); case PLMPackage.PARTICIPATION___GET_NAME: return getName(); case PLMPackage.PARTICIPATION___CONFORMS__PARTICIPATION: return conforms((Participation)arguments.get(0)); } 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(" (lower: "); result.append(lower); result.append(", upper: "); result.append(upper); result.append(", navigable: "); result.append(navigable); result.append(", expressedParticipationName: "); result.append(expressedParticipationName); result.append(", containment: "); result.append(containment); result.append(')'); return result.toString(); } } //ParticipationImpl