org.eclipse.uml2.uml.internal.impl.OccurrenceSpecificationImpl Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2005, 2014 IBM Corporation, CEA, 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
* Kenn Hussey (CEA) - 327039, 297216, 418466
*
*/
package org.eclipse.uml2.uml.internal.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Map;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.uml2.uml.Comment;
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.NamedElement;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.OccurrenceSpecification;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.StringExpression;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.VisibilityKind;
import org.eclipse.uml2.uml.internal.operations.OccurrenceSpecificationOperations;
/**
*
* An implementation of the model object 'Occurrence Specification'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.uml2.uml.internal.impl.OccurrenceSpecificationImpl#getToAfters To After}
* - {@link org.eclipse.uml2.uml.internal.impl.OccurrenceSpecificationImpl#getToBefores To Before}
* - {@link org.eclipse.uml2.uml.internal.impl.OccurrenceSpecificationImpl#getCovereds Covered}
*
*
*
* @generated
*/
public class OccurrenceSpecificationImpl
extends InteractionFragmentImpl
implements OccurrenceSpecification {
/**
* The cached value of the '{@link #getToAfters() To After}' reference list.
*
*
* @see #getToAfters()
* @generated
* @ordered
*/
protected EList toAfters;
/**
* The cached value of the '{@link #getToBefores() To Before}' reference list.
*
*
* @see #getToBefores()
* @generated
* @ordered
*/
protected EList toBefores;
/**
*
*
* @generated
*/
protected OccurrenceSpecificationImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return UMLPackage.Literals.OCCURRENCE_SPECIFICATION;
}
/**
*
*
* @generated
*/
public EList getToBefores() {
if (toBefores == null) {
toBefores = new EObjectWithInverseResolvingEList(
GeneralOrdering.class, this,
UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE,
UMLPackage.GENERAL_ORDERING__AFTER);
}
return toBefores;
}
/**
*
*
* @generated
*/
public GeneralOrdering getToBefore(String name) {
return getToBefore(name, false);
}
/**
*
*
* @generated
*/
public GeneralOrdering getToBefore(String name, boolean ignoreCase) {
toBeforeLoop : for (GeneralOrdering toBefore : getToBefores()) {
if (name != null && !(ignoreCase
? name.equalsIgnoreCase(toBefore.getName())
: name.equals(toBefore.getName())))
continue toBeforeLoop;
return toBefore;
}
return null;
}
/**
*
*
* @generated
*/
public EList getToAfters() {
if (toAfters == null) {
toAfters = new EObjectWithInverseResolvingEList(
GeneralOrdering.class, this,
UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER,
UMLPackage.GENERAL_ORDERING__BEFORE);
}
return toAfters;
}
/**
*
*
* @generated
*/
public GeneralOrdering getToAfter(String name) {
return getToAfter(name, false);
}
/**
*
*
* @generated
*/
public GeneralOrdering getToAfter(String name, boolean ignoreCase) {
toAfterLoop : for (GeneralOrdering toAfter : getToAfters()) {
if (name != null && !(ignoreCase
? name.equalsIgnoreCase(toAfter.getName())
: name.equals(toAfter.getName())))
continue toAfterLoop;
return toAfter;
}
return null;
}
/**
*
*
* @generated
*/
@Override
public EList getCovereds() {
if (covereds == null) {
covereds = new EObjectWithInverseResolvingEList.ManyInverse(
Lifeline.class, this,
UMLPackage.OCCURRENCE_SPECIFICATION__COVERED,
UMLPackage.LIFELINE__COVERED_BY);
}
return covereds;
}
/**
*
*
* @generated
*/
public Lifeline getCovered(String name) {
return getCovered(name, false);
}
/**
*
*
* @generated
*/
public Lifeline getCovered(String name, boolean ignoreCase) {
coveredLoop : for (Lifeline covered : getCovereds()) {
if (name != null && !(ignoreCase
? name.equalsIgnoreCase(covered.getName())
: name.equals(covered.getName())))
continue coveredLoop;
return covered;
}
return null;
}
/**
*
*
* @generated
*/
public boolean isSetCovereds() {
return covereds != null && !covereds.isEmpty();
}
/**
*
*
* @generated
*/
public Lifeline getCovered() {
return OccurrenceSpecificationOperations.getCovered(this);
}
/**
*
*
* @generated
*/
public void setCovered(Lifeline value) {
OccurrenceSpecificationOperations.setCovered(this, value);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS :
return ((InternalEList) (InternalEList>) getEAnnotations())
.basicAdd(otherEnd, msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED :
return ((InternalEList) (InternalEList>) getCovereds())
.basicAdd(otherEnd, msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND :
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetEnclosingOperand((InteractionOperand) otherEnd,
msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION :
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetEnclosingInteraction((Interaction) otherEnd,
msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER :
return ((InternalEList) (InternalEList>) getToAfters())
.basicAdd(otherEnd, msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE :
return ((InternalEList) (InternalEList>) getToBefores())
.basicAdd(otherEnd, msgs);
}
return eDynamicInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
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__NAME_EXPRESSION :
return basicSetNameExpression(null, msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED :
return ((InternalEList>) getCovereds()).basicRemove(otherEnd,
msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND :
return basicSetEnclosingOperand(null, msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION :
return basicSetEnclosingInteraction(null, msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING :
return ((InternalEList>) getGeneralOrderings()).basicRemove(
otherEnd, msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER :
return ((InternalEList>) getToAfters()).basicRemove(otherEnd,
msgs);
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE :
return ((InternalEList>) getToBefores()).basicRemove(
otherEnd, msgs);
}
return eDynamicInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS :
return getEAnnotations();
case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_COMMENT :
return getOwnedComments();
case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_ELEMENT :
return getOwnedElements();
case UMLPackage.OCCURRENCE_SPECIFICATION__OWNER :
if (resolve)
return getOwner();
return basicGetOwner();
case UMLPackage.OCCURRENCE_SPECIFICATION__CLIENT_DEPENDENCY :
return getClientDependencies();
case UMLPackage.OCCURRENCE_SPECIFICATION__NAME :
return getName();
case UMLPackage.OCCURRENCE_SPECIFICATION__NAME_EXPRESSION :
if (resolve)
return getNameExpression();
return basicGetNameExpression();
case UMLPackage.OCCURRENCE_SPECIFICATION__NAMESPACE :
if (resolve)
return getNamespace();
return basicGetNamespace();
case UMLPackage.OCCURRENCE_SPECIFICATION__QUALIFIED_NAME :
return getQualifiedName();
case UMLPackage.OCCURRENCE_SPECIFICATION__VISIBILITY :
return getVisibility();
case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED :
return getCovereds();
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND :
if (resolve)
return getEnclosingOperand();
return basicGetEnclosingOperand();
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION :
if (resolve)
return getEnclosingInteraction();
return basicGetEnclosingInteraction();
case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING :
return getGeneralOrderings();
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER :
return getToAfters();
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE :
return getToBefores();
}
return eDynamicGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS :
getEAnnotations().clear();
getEAnnotations().addAll(
(Collection extends EAnnotation>) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_COMMENT :
getOwnedComments().clear();
getOwnedComments().addAll(
(Collection extends Comment>) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__NAME :
setName((String) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__NAME_EXPRESSION :
setNameExpression((StringExpression) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__VISIBILITY :
setVisibility((VisibilityKind) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED :
getCovereds().clear();
getCovereds().addAll((Collection extends Lifeline>) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND :
setEnclosingOperand((InteractionOperand) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION :
setEnclosingInteraction((Interaction) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING :
getGeneralOrderings().clear();
getGeneralOrderings().addAll(
(Collection extends GeneralOrdering>) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER :
getToAfters().clear();
getToAfters().addAll(
(Collection extends GeneralOrdering>) newValue);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE :
getToBefores().clear();
getToBefores().addAll(
(Collection extends GeneralOrdering>) newValue);
return;
}
eDynamicSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
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__NAME_EXPRESSION :
setNameExpression((StringExpression) null);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__VISIBILITY :
unsetVisibility();
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED :
getCovereds().clear();
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND :
setEnclosingOperand((InteractionOperand) null);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION :
setEnclosingInteraction((Interaction) null);
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING :
getGeneralOrderings().clear();
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER :
getToAfters().clear();
return;
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE :
getToBefores().clear();
return;
}
eDynamicUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case UMLPackage.OCCURRENCE_SPECIFICATION__EANNOTATIONS :
return eAnnotations != null && !eAnnotations.isEmpty();
case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_COMMENT :
return ownedComments != null && !ownedComments.isEmpty();
case UMLPackage.OCCURRENCE_SPECIFICATION__OWNED_ELEMENT :
return isSetOwnedElements();
case UMLPackage.OCCURRENCE_SPECIFICATION__OWNER :
return isSetOwner();
case UMLPackage.OCCURRENCE_SPECIFICATION__CLIENT_DEPENDENCY :
return !getClientDependencies().isEmpty();
case UMLPackage.OCCURRENCE_SPECIFICATION__NAME :
return isSetName();
case UMLPackage.OCCURRENCE_SPECIFICATION__NAME_EXPRESSION :
return nameExpression != null;
case UMLPackage.OCCURRENCE_SPECIFICATION__NAMESPACE :
return isSetNamespace();
case UMLPackage.OCCURRENCE_SPECIFICATION__QUALIFIED_NAME :
return QUALIFIED_NAME_EDEFAULT == null
? getQualifiedName() != null
: !QUALIFIED_NAME_EDEFAULT.equals(getQualifiedName());
case UMLPackage.OCCURRENCE_SPECIFICATION__VISIBILITY :
return isSetVisibility();
case UMLPackage.OCCURRENCE_SPECIFICATION__COVERED :
return isSetCovereds();
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_OPERAND :
return basicGetEnclosingOperand() != null;
case UMLPackage.OCCURRENCE_SPECIFICATION__ENCLOSING_INTERACTION :
return basicGetEnclosingInteraction() != null;
case UMLPackage.OCCURRENCE_SPECIFICATION__GENERAL_ORDERING :
return generalOrderings != null && !generalOrderings.isEmpty();
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_AFTER :
return toAfters != null && !toAfters.isEmpty();
case UMLPackage.OCCURRENCE_SPECIFICATION__TO_BEFORE :
return toBefores != null && !toBefores.isEmpty();
}
return eDynamicIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
@SuppressWarnings("unchecked")
public Object eInvoke(int operationID, EList> arguments)
throws InvocationTargetException {
switch (operationID) {
case UMLPackage.OCCURRENCE_SPECIFICATION___GET_EANNOTATION__STRING :
return getEAnnotation((String) arguments.get(0));
case UMLPackage.OCCURRENCE_SPECIFICATION___VALIDATE_HAS_OWNER__DIAGNOSTICCHAIN_MAP :
return validateHasOwner((DiagnosticChain) arguments.get(0),
(Map