| /* |
| * Copyright (c) 2005, 2006 IBM Corporation and others. |
| * 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: |
| * IBM - initial API and implementation |
| * |
| * $Id: OccurrenceSpecificationImpl.java,v 1.16 2006/04/10 19:16:19 khussey Exp $ |
| */ |
| package org.eclipse.uml2.uml.internal.impl; |
| |
| import java.util.Collection; |
| import java.util.Iterator; |
| 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.EObjectWithInverseResolvingEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.uml2.uml.Event; |
| import org.eclipse.uml2.uml.GeneralOrdering; |
| import org.eclipse.uml2.uml.Interaction; |
| import org.eclipse.uml2.uml.InteractionOperand; |
| import org.eclipse.uml2.uml.Lifeline; |
| import org.eclipse.uml2.uml.OccurrenceSpecification; |
| import org.eclipse.uml2.uml.StringExpression; |
| import org.eclipse.uml2.uml.UMLPackage; |
| import org.eclipse.uml2.uml.VisibilityKind; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Occurrence Specification</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.uml2.uml.internal.impl.OccurrenceSpecificationImpl#getToBefores <em>To Before</em>}</li> |
| * <li>{@link org.eclipse.uml2.uml.internal.impl.OccurrenceSpecificationImpl#getEvent <em>Event</em>}</li> |
| * <li>{@link org.eclipse.uml2.uml.internal.impl.OccurrenceSpecificationImpl#getToAfters <em>To After</em>}</li> |
| * <li>{@link org.eclipse.uml2.uml.internal.impl.OccurrenceSpecificationImpl#getCovereds <em>Covered</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class OccurrenceSpecificationImpl |
| extends InteractionFragmentImpl |
| implements OccurrenceSpecification { |
| |
| /** |
| * The cached value of the '{@link #getToBefores() <em>To Before</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getToBefores() |
| * @generated |
| * @ordered |
| */ |
| protected EList toBefores = null; |
| |
| /** |
| * The cached value of the '{@link #getEvent() <em>Event</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEvent() |
| * @generated |
| * @ordered |
| */ |
| protected Event event = null; |
| |
| /** |
| * The cached value of the '{@link #getToAfters() <em>To After</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getToAfters() |
| * @generated |
| * @ordered |
| */ |
| protected EList toAfters = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected OccurrenceSpecificationImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EClass eStaticClass() { |
| return UMLPackage.Literals.OCCURRENCE_SPECIFICATION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList getToBefores() { |
| if (toBefores == null) { |
| toBefores = new EObjectWithInverseResolvingEList( |
| GeneralOrdering.class, this, |
| UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE, |
| UMLPackage.GENERAL_ORDERING__AFTER); |
| } |
| return toBefores; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public GeneralOrdering getToBefore(String name) { |
| return getToBefore(name, false); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public GeneralOrdering getToBefore(String name, boolean ignoreCase) { |
| toBeforeLoop : for (Iterator i = getToBefores().iterator(); i.hasNext();) { |
| GeneralOrdering toBefore = (GeneralOrdering) i.next(); |
| if (name != null && !(ignoreCase |
| ? name.equalsIgnoreCase(toBefore.getName()) |
| : name.equals(toBefore.getName()))) |
| continue toBeforeLoop; |
| return toBefore; |
| } |
| return null; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Event getEvent() { |
| if (event != null && event.eIsProxy()) { |
| InternalEObject oldEvent = (InternalEObject) event; |
| event = (Event) eResolveProxy(oldEvent); |
| if (event != oldEvent) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, |
| UMLPackage.OCCURRENCE_SPECIFICATION__EVENT, oldEvent, |
| event)); |
| } |
| } |
| return event; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Event basicGetEvent() { |
| return event; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEvent(Event newEvent) { |
| Event oldEvent = event; |
| event = newEvent; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, |
| UMLPackage.OCCURRENCE_SPECIFICATION__EVENT, oldEvent, event)); |
| |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList getToAfters() { |
| if (toAfters == null) { |
| toAfters = new EObjectWithInverseResolvingEList( |
| GeneralOrdering.class, this, |
| UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER, |
| UMLPackage.GENERAL_ORDERING__BEFORE); |
| } |
| return toAfters; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public GeneralOrdering getToAfter(String name) { |
| return getToAfter(name, false); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public GeneralOrdering getToAfter(String name, boolean ignoreCase) { |
| toAfterLoop : for (Iterator i = getToAfters().iterator(); i.hasNext();) { |
| GeneralOrdering toAfter = (GeneralOrdering) i.next(); |
| if (name != null && !(ignoreCase |
| ? name.equalsIgnoreCase(toAfter.getName()) |
| : name.equals(toAfter.getName()))) |
| continue toAfterLoop; |
| return toAfter; |
| } |
| return null; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList getCovereds() { |
| if (covereds == null) { |
| covereds = new EObjectWithInverseResolvingEList.ManyInverse( |
| Lifeline.class, this, |
| UMLPackage.OCCURRENCE_SPECIFICATION__COVERED, |
| UMLPackage.LIFELINE__COVERED_BY); |
| } |
| return covereds; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Lifeline getCovered(String name) { |
| return getCovered(name, false); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Lifeline getCovered(String name, boolean ignoreCase) { |
| coveredLoop : for (Iterator i = getCovereds().iterator(); i.hasNext();) { |
| Lifeline covered = (Lifeline) i.next(); |
| if (name != null && !(ignoreCase |
| ? name.equalsIgnoreCase(covered.getName()) |
| : name.equals(covered.getName()))) |
| continue coveredLoop; |
| return covered; |
| } |
| return null; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isSetCovereds() { |
| return covereds != null && !covereds.isEmpty(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS : |
| return ((InternalEList) getEAnnotations()).basicAdd(otherEnd, |
| msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__CLIENT_DEPENDENCY : |
| return ((InternalEList) getClientDependencies()).basicAdd( |
| otherEnd, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED : |
| return ((InternalEList) getCovereds()).basicAdd(otherEnd, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION : |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetEnclosingInteraction((Interaction) otherEnd, |
| msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND : |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetEnclosingOperand((InteractionOperand) otherEnd, |
| msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE : |
| return ((InternalEList) getToBefores()) |
| .basicAdd(otherEnd, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER : |
| return ((InternalEList) getToAfters()).basicAdd(otherEnd, msgs); |
| } |
| return eDynamicInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS : |
| return ((InternalEList) getEAnnotations()).basicRemove( |
| otherEnd, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_COMMENT : |
| return ((InternalEList) getOwnedComments()).basicRemove( |
| otherEnd, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__CLIENT_DEPENDENCY : |
| return ((InternalEList) getClientDependencies()).basicRemove( |
| otherEnd, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME_EXPRESSION : |
| return basicSetNameExpression(null, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED : |
| return ((InternalEList) getCovereds()).basicRemove(otherEnd, |
| msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING : |
| return ((InternalEList) getGeneralOrderings()).basicRemove( |
| otherEnd, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION : |
| return basicSetEnclosingInteraction(null, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND : |
| return basicSetEnclosingOperand(null, msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE : |
| return ((InternalEList) getToBefores()).basicRemove(otherEnd, |
| msgs); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER : |
| return ((InternalEList) getToAfters()).basicRemove(otherEnd, |
| msgs); |
| } |
| return eDynamicInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS : |
| return getEAnnotations(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_ELEMENT : |
| return getOwnedElements(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNER : |
| if (resolve) |
| return getOwner(); |
| return basicGetOwner(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_COMMENT : |
| return getOwnedComments(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME : |
| return getName(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__VISIBILITY : |
| return getVisibility(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__QUALIFIED_NAME : |
| return getQualifiedName(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__CLIENT_DEPENDENCY : |
| return getClientDependencies(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAMESPACE : |
| if (resolve) |
| return getNamespace(); |
| return basicGetNamespace(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME_EXPRESSION : |
| if (resolve) |
| return getNameExpression(); |
| return basicGetNameExpression(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED : |
| return getCovereds(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING : |
| return getGeneralOrderings(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION : |
| if (resolve) |
| return getEnclosingInteraction(); |
| return basicGetEnclosingInteraction(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND : |
| if (resolve) |
| return getEnclosingOperand(); |
| return basicGetEnclosingOperand(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE : |
| return getToBefores(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EVENT : |
| if (resolve) |
| return getEvent(); |
| return basicGetEvent(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER : |
| return getToAfters(); |
| } |
| return eDynamicGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS : |
| getEAnnotations().clear(); |
| getEAnnotations().addAll((Collection) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_COMMENT : |
| getOwnedComments().clear(); |
| getOwnedComments().addAll((Collection) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME : |
| setName((String) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__VISIBILITY : |
| setVisibility((VisibilityKind) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__CLIENT_DEPENDENCY : |
| getClientDependencies().clear(); |
| getClientDependencies().addAll((Collection) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME_EXPRESSION : |
| setNameExpression((StringExpression) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED : |
| getCovereds().clear(); |
| getCovereds().addAll((Collection) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING : |
| getGeneralOrderings().clear(); |
| getGeneralOrderings().addAll((Collection) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION : |
| setEnclosingInteraction((Interaction) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND : |
| setEnclosingOperand((InteractionOperand) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE : |
| getToBefores().clear(); |
| getToBefores().addAll((Collection) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EVENT : |
| setEvent((Event) newValue); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER : |
| getToAfters().clear(); |
| getToAfters().addAll((Collection) newValue); |
| return; |
| } |
| eDynamicSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS : |
| getEAnnotations().clear(); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_COMMENT : |
| getOwnedComments().clear(); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME : |
| unsetName(); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__VISIBILITY : |
| unsetVisibility(); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__CLIENT_DEPENDENCY : |
| getClientDependencies().clear(); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME_EXPRESSION : |
| setNameExpression((StringExpression) null); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED : |
| getCovereds().clear(); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING : |
| getGeneralOrderings().clear(); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION : |
| setEnclosingInteraction((Interaction) null); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND : |
| setEnclosingOperand((InteractionOperand) null); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE : |
| getToBefores().clear(); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EVENT : |
| setEvent((Event) null); |
| return; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER : |
| getToAfters().clear(); |
| return; |
| } |
| eDynamicUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS : |
| return eAnnotations != null && !eAnnotations.isEmpty(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_ELEMENT : |
| return isSetOwnedElements(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNER : |
| return isSetOwner(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_COMMENT : |
| return ownedComments != null && !ownedComments.isEmpty(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME : |
| return isSetName(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__VISIBILITY : |
| return isSetVisibility(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__QUALIFIED_NAME : |
| return QUALIFIED_NAME_EDEFAULT == null |
| ? getQualifiedName() != null |
| : !QUALIFIED_NAME_EDEFAULT.equals(getQualifiedName()); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__CLIENT_DEPENDENCY : |
| return clientDependencies != null |
| && !clientDependencies.isEmpty(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAMESPACE : |
| return isSetNamespace(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__NAME_EXPRESSION : |
| return nameExpression != null; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED : |
| return isSetCovereds(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING : |
| return generalOrderings != null && !generalOrderings.isEmpty(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION : |
| return basicGetEnclosingInteraction() != null; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND : |
| return basicGetEnclosingOperand() != null; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE : |
| return toBefores != null && !toBefores.isEmpty(); |
| case UMLPackage.OCCURRENCE_SPECIFICATION__EVENT : |
| return event != null; |
| case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER : |
| return toAfters != null && !toAfters.isEmpty(); |
| } |
| return eDynamicIsSet(featureID); |
| } |
| |
| } //OccurrenceSpecificationImpl |