blob: 49fc81d780b129286336564138587bb67b63ec4c [file] [log] [blame]
/*
* Copyright (c) 2005 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: VariableImpl.java,v 1.2 2005/11/16 19:03:04 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.impl;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.uml2.common.util.DerivedUnionEObjectEList;
import org.eclipse.uml2.uml.Action;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.MultiplicityElement;
import org.eclipse.uml2.uml.StringExpression;
import org.eclipse.uml2.uml.StructuredActivityNode;
import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValueSpecification;
import org.eclipse.uml2.uml.Variable;
import org.eclipse.uml2.uml.VisibilityKind;
import org.eclipse.uml2.uml.internal.operations.MultiplicityElementOperations;
import org.eclipse.uml2.uml.internal.operations.VariableOperations;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Variable</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#getOwnedElements <em>Owned Element</em>}</li>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#isOrdered <em>Is Ordered</em>}</li>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#isUnique <em>Is Unique</em>}</li>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#getUpper <em>Upper</em>}</li>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#getLower <em>Lower</em>}</li>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#getUpperValue <em>Upper Value</em>}</li>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#getLowerValue <em>Lower Value</em>}</li>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#getActivityScope <em>Activity Scope</em>}</li>
* <li>{@link org.eclipse.uml2.uml.internal.impl.VariableImpl#getScope <em>Scope</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class VariableImpl
extends TypedElementImpl
implements Variable {
/**
* The default value of the '{@link #isOrdered() <em>Is Ordered</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOrdered()
* @generated
* @ordered
*/
protected static final boolean IS_ORDERED_EDEFAULT = false;
/**
* The flag representing the value of the '{@link #isOrdered() <em>Is Ordered</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOrdered()
* @generated
* @ordered
*/
protected static final int IS_ORDERED_EFLAG = 1 << 8;
/**
* The default value of the '{@link #isUnique() <em>Is Unique</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isUnique()
* @generated
* @ordered
*/
protected static final boolean IS_UNIQUE_EDEFAULT = true;
/**
* The flag representing the value of the '{@link #isUnique() <em>Is Unique</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isUnique()
* @generated
* @ordered
*/
protected static final int IS_UNIQUE_EFLAG = 1 << 9;
/**
* The default value of the '{@link #getUpper() <em>Upper</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUpper()
* @generated
* @ordered
*/
protected static final int UPPER_EDEFAULT = 1;
/**
* The default value of the '{@link #getLower() <em>Lower</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLower()
* @generated
* @ordered
*/
protected static final int LOWER_EDEFAULT = 1;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected VariableImpl() {
super();
eFlags |= IS_UNIQUE_EFLAG;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return UMLPackage.eINSTANCE.getVariable();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public List getOwnedElements() {
List ownedElement = (List) eVirtualGet(UMLPackage.VARIABLE__OWNED_ELEMENT);
if (ownedElement == null) {
eVirtualSet(UMLPackage.VARIABLE__OWNED_ELEMENT,
ownedElement = new DerivedUnionEObjectEList(Element.class,
this, UMLPackage.VARIABLE__OWNED_ELEMENT,
new EStructuralFeature[]{
UMLPackage.eINSTANCE.getElement_OwnedComment(),
UMLPackage.eINSTANCE.getNamedElement_NameExpression(),
UMLPackage.eINSTANCE
.getMultiplicityElement_UpperValue(),
UMLPackage.eINSTANCE
.getMultiplicityElement_LowerValue()}));
}
return ownedElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isOrdered() {
return (eFlags & IS_ORDERED_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsOrdered(boolean newIsOrdered) {
boolean oldIsOrdered = (eFlags & IS_ORDERED_EFLAG) != 0;
if (newIsOrdered)
eFlags |= IS_ORDERED_EFLAG;
else
eFlags &= ~IS_ORDERED_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
UMLPackage.VARIABLE__IS_ORDERED, oldIsOrdered, newIsOrdered));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isUnique() {
return (eFlags & IS_UNIQUE_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsUnique(boolean newIsUnique) {
boolean oldIsUnique = (eFlags & IS_UNIQUE_EFLAG) != 0;
if (newIsUnique)
eFlags |= IS_UNIQUE_EFLAG;
else
eFlags &= ~IS_UNIQUE_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
UMLPackage.VARIABLE__IS_UNIQUE, oldIsUnique, newIsUnique));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getUpper() {
return MultiplicityElementOperations.getUpper(this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUpper(int newUpper) {
MultiplicityElementOperations.setUpper(this, newUpper);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getLower() {
return MultiplicityElementOperations.getLower(this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLower(int newLower) {
MultiplicityElementOperations.setLower(this, newLower);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueSpecification getUpperValue() {
ValueSpecification upperValue = (ValueSpecification) eVirtualGet(UMLPackage.VARIABLE__UPPER_VALUE);
return upperValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetUpperValue(
ValueSpecification newUpperValue, NotificationChain msgs) {
Object oldUpperValue = eVirtualSet(UMLPackage.VARIABLE__UPPER_VALUE,
newUpperValue);
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, UMLPackage.VARIABLE__UPPER_VALUE,
oldUpperValue == EVIRTUAL_NO_VALUE
? null
: oldUpperValue, newUpperValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUpperValue(ValueSpecification newUpperValue) {
ValueSpecification upperValue = (ValueSpecification) eVirtualGet(UMLPackage.VARIABLE__UPPER_VALUE);
if (newUpperValue != upperValue) {
NotificationChain msgs = null;
if (upperValue != null)
msgs = ((InternalEObject) upperValue).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - UMLPackage.VARIABLE__UPPER_VALUE,
null, msgs);
if (newUpperValue != null)
msgs = ((InternalEObject) newUpperValue).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - UMLPackage.VARIABLE__UPPER_VALUE,
null, msgs);
msgs = basicSetUpperValue(newUpperValue, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
UMLPackage.VARIABLE__UPPER_VALUE, newUpperValue, newUpperValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueSpecification createUpperValue(EClass eClass) {
ValueSpecification newUpperValue = (ValueSpecification) eClass
.getEPackage().getEFactoryInstance().create(eClass);
setUpperValue(newUpperValue);
return newUpperValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueSpecification getLowerValue() {
ValueSpecification lowerValue = (ValueSpecification) eVirtualGet(UMLPackage.VARIABLE__LOWER_VALUE);
return lowerValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLowerValue(
ValueSpecification newLowerValue, NotificationChain msgs) {
Object oldLowerValue = eVirtualSet(UMLPackage.VARIABLE__LOWER_VALUE,
newLowerValue);
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, UMLPackage.VARIABLE__LOWER_VALUE,
oldLowerValue == EVIRTUAL_NO_VALUE
? null
: oldLowerValue, newLowerValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLowerValue(ValueSpecification newLowerValue) {
ValueSpecification lowerValue = (ValueSpecification) eVirtualGet(UMLPackage.VARIABLE__LOWER_VALUE);
if (newLowerValue != lowerValue) {
NotificationChain msgs = null;
if (lowerValue != null)
msgs = ((InternalEObject) lowerValue).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - UMLPackage.VARIABLE__LOWER_VALUE,
null, msgs);
if (newLowerValue != null)
msgs = ((InternalEObject) newLowerValue).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - UMLPackage.VARIABLE__LOWER_VALUE,
null, msgs);
msgs = basicSetLowerValue(newLowerValue, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
UMLPackage.VARIABLE__LOWER_VALUE, newLowerValue, newLowerValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueSpecification createLowerValue(EClass eClass) {
ValueSpecification newLowerValue = (ValueSpecification) eClass
.getEPackage().getEFactoryInstance().create(eClass);
setLowerValue(newLowerValue);
return newLowerValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Activity getActivityScope() {
if (eContainerFeatureID != UMLPackage.VARIABLE__ACTIVITY_SCOPE)
return null;
return (Activity) eContainer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setActivityScope(Activity newActivityScope) {
if (newActivityScope != eContainer
|| (eContainerFeatureID != UMLPackage.VARIABLE__ACTIVITY_SCOPE && newActivityScope != null)) {
if (EcoreUtil.isAncestor(this, (EObject) newActivityScope))
throw new IllegalArgumentException(
"Recursive containment not allowed for " + toString()); //$NON-NLS-1$
NotificationChain msgs = null;
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newActivityScope != null)
msgs = ((InternalEObject) newActivityScope).eInverseAdd(this,
UMLPackage.ACTIVITY__VARIABLE, Activity.class, msgs);
msgs = eBasicSetContainer((InternalEObject) newActivityScope,
UMLPackage.VARIABLE__ACTIVITY_SCOPE, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
UMLPackage.VARIABLE__ACTIVITY_SCOPE, newActivityScope,
newActivityScope));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StructuredActivityNode getScope() {
if (eContainerFeatureID != UMLPackage.VARIABLE__SCOPE)
return null;
return (StructuredActivityNode) eContainer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setScope(StructuredActivityNode newScope) {
if (newScope != eContainer
|| (eContainerFeatureID != UMLPackage.VARIABLE__SCOPE && newScope != null)) {
if (EcoreUtil.isAncestor(this, (EObject) newScope))
throw new IllegalArgumentException(
"Recursive containment not allowed for " + toString()); //$NON-NLS-1$
NotificationChain msgs = null;
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newScope != null)
msgs = ((InternalEObject) newScope).eInverseAdd(this,
UMLPackage.STRUCTURED_ACTIVITY_NODE__VARIABLE,
StructuredActivityNode.class, msgs);
msgs = eBasicSetContainer((InternalEObject) newScope,
UMLPackage.VARIABLE__SCOPE, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
UMLPackage.VARIABLE__SCOPE, newScope, newScope));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateUpperGt0(DiagnosticChain diagnostics, Map context) {
return MultiplicityElementOperations.validateUpperGt0(this,
diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateLowerGe0(DiagnosticChain diagnostics, Map context) {
return MultiplicityElementOperations.validateLowerGe0(this,
diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateUpperGeLower(DiagnosticChain diagnostics, Map context) {
return MultiplicityElementOperations.validateUpperGeLower(this,
diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateValueSpecificationNoSideEffects(
DiagnosticChain diagnostics, Map context) {
return MultiplicityElementOperations
.validateValueSpecificationNoSideEffects(this, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateValueSpecificationConstant(
DiagnosticChain diagnostics, Map context) {
return MultiplicityElementOperations
.validateValueSpecificationConstant(this, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isMultivalued() {
return MultiplicityElementOperations.isMultivalued(this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean includesCardinality(int C) {
return MultiplicityElementOperations.includesCardinality(this, C);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean includesMultiplicity(MultiplicityElement M) {
return MultiplicityElementOperations.includesMultiplicity(this, M);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int lowerBound() {
return MultiplicityElementOperations.lowerBound(this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int upperBound() {
return MultiplicityElementOperations.upperBound(this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateOwned(DiagnosticChain diagnostics, Map context) {
return VariableOperations.validateOwned(this, diagnostics, context);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isAccessibleBy(Action a) {
return VariableOperations.isAccessibleBy(this, a);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseAdd(InternalEObject otherEnd,
int featureID, Class baseClass, NotificationChain msgs) {
if (featureID >= 0) {
switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
case UMLPackage.VARIABLE__EANNOTATIONS :
return ((InternalEList) getEAnnotations()).basicAdd(
otherEnd, msgs);
case UMLPackage.VARIABLE__CLIENT_DEPENDENCY :
return ((InternalEList) getClientDependencies()).basicAdd(
otherEnd, msgs);
case UMLPackage.VARIABLE__ACTIVITY_SCOPE :
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
return eBasicSetContainer(otherEnd,
UMLPackage.VARIABLE__ACTIVITY_SCOPE, msgs);
case UMLPackage.VARIABLE__SCOPE :
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
return eBasicSetContainer(otherEnd,
UMLPackage.VARIABLE__SCOPE, msgs);
default :
return eDynamicInverseAdd(otherEnd, featureID, baseClass,
msgs);
}
}
if (eContainer != null)
msgs = eBasicRemoveFromContainer(msgs);
return eBasicSetContainer(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, Class baseClass, NotificationChain msgs) {
if (featureID >= 0) {
switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
case UMLPackage.VARIABLE__EANNOTATIONS :
return ((InternalEList) getEAnnotations()).basicRemove(
otherEnd, msgs);
case UMLPackage.VARIABLE__OWNED_COMMENT :
return ((InternalEList) getOwnedComments()).basicRemove(
otherEnd, msgs);
case UMLPackage.VARIABLE__CLIENT_DEPENDENCY :
return ((InternalEList) getClientDependencies())
.basicRemove(otherEnd, msgs);
case UMLPackage.VARIABLE__NAME_EXPRESSION :
return basicSetNameExpression(null, msgs);
case UMLPackage.VARIABLE__UPPER_VALUE :
return basicSetUpperValue(null, msgs);
case UMLPackage.VARIABLE__LOWER_VALUE :
return basicSetLowerValue(null, msgs);
case UMLPackage.VARIABLE__ACTIVITY_SCOPE :
return eBasicSetContainer(null,
UMLPackage.VARIABLE__ACTIVITY_SCOPE, msgs);
case UMLPackage.VARIABLE__SCOPE :
return eBasicSetContainer(null, UMLPackage.VARIABLE__SCOPE,
msgs);
default :
return eDynamicInverseRemove(otherEnd, featureID,
baseClass, msgs);
}
}
return eBasicSetContainer(null, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) {
if (eContainerFeatureID >= 0) {
switch (eContainerFeatureID) {
case UMLPackage.VARIABLE__ACTIVITY_SCOPE :
return eContainer.eInverseRemove(this,
UMLPackage.ACTIVITY__VARIABLE, Activity.class, msgs);
case UMLPackage.VARIABLE__SCOPE :
return eContainer.eInverseRemove(this,
UMLPackage.STRUCTURED_ACTIVITY_NODE__VARIABLE,
StructuredActivityNode.class, msgs);
default :
return eDynamicBasicRemoveFromContainer(msgs);
}
}
return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE
- eContainerFeatureID, null, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(EStructuralFeature eFeature, boolean resolve) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UMLPackage.VARIABLE__EANNOTATIONS :
return getEAnnotations();
case UMLPackage.VARIABLE__OWNED_ELEMENT :
return getOwnedElements();
case UMLPackage.VARIABLE__OWNER :
if (resolve)
return getOwner();
return basicGetOwner();
case UMLPackage.VARIABLE__OWNED_COMMENT :
return getOwnedComments();
case UMLPackage.VARIABLE__NAME :
return getName();
case UMLPackage.VARIABLE__VISIBILITY :
return getVisibility();
case UMLPackage.VARIABLE__QUALIFIED_NAME :
return getQualifiedName();
case UMLPackage.VARIABLE__CLIENT_DEPENDENCY :
return getClientDependencies();
case UMLPackage.VARIABLE__NAMESPACE :
if (resolve)
return getNamespace();
return basicGetNamespace();
case UMLPackage.VARIABLE__NAME_EXPRESSION :
return getNameExpression();
case UMLPackage.VARIABLE__TYPE :
if (resolve)
return getType();
return basicGetType();
case UMLPackage.VARIABLE__IS_ORDERED :
return isOrdered()
? Boolean.TRUE
: Boolean.FALSE;
case UMLPackage.VARIABLE__IS_UNIQUE :
return isUnique()
? Boolean.TRUE
: Boolean.FALSE;
case UMLPackage.VARIABLE__UPPER :
return new Integer(getUpper());
case UMLPackage.VARIABLE__LOWER :
return new Integer(getLower());
case UMLPackage.VARIABLE__UPPER_VALUE :
return getUpperValue();
case UMLPackage.VARIABLE__LOWER_VALUE :
return getLowerValue();
case UMLPackage.VARIABLE__ACTIVITY_SCOPE :
return getActivityScope();
case UMLPackage.VARIABLE__SCOPE :
return getScope();
}
return eDynamicGet(eFeature, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(EStructuralFeature eFeature, Object newValue) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UMLPackage.VARIABLE__EANNOTATIONS :
getEAnnotations().clear();
getEAnnotations().addAll((Collection) newValue);
return;
case UMLPackage.VARIABLE__OWNED_COMMENT :
getOwnedComments().clear();
getOwnedComments().addAll((Collection) newValue);
return;
case UMLPackage.VARIABLE__NAME :
setName((String) newValue);
return;
case UMLPackage.VARIABLE__VISIBILITY :
setVisibility((VisibilityKind) newValue);
return;
case UMLPackage.VARIABLE__CLIENT_DEPENDENCY :
getClientDependencies().clear();
getClientDependencies().addAll((Collection) newValue);
return;
case UMLPackage.VARIABLE__NAME_EXPRESSION :
setNameExpression((StringExpression) newValue);
return;
case UMLPackage.VARIABLE__TYPE :
setType((Type) newValue);
return;
case UMLPackage.VARIABLE__IS_ORDERED :
setIsOrdered(((Boolean) newValue).booleanValue());
return;
case UMLPackage.VARIABLE__IS_UNIQUE :
setIsUnique(((Boolean) newValue).booleanValue());
return;
case UMLPackage.VARIABLE__UPPER :
setUpper(((Integer) newValue).intValue());
return;
case UMLPackage.VARIABLE__LOWER :
setLower(((Integer) newValue).intValue());
return;
case UMLPackage.VARIABLE__UPPER_VALUE :
setUpperValue((ValueSpecification) newValue);
return;
case UMLPackage.VARIABLE__LOWER_VALUE :
setLowerValue((ValueSpecification) newValue);
return;
case UMLPackage.VARIABLE__ACTIVITY_SCOPE :
setActivityScope((Activity) newValue);
return;
case UMLPackage.VARIABLE__SCOPE :
setScope((StructuredActivityNode) newValue);
return;
}
eDynamicSet(eFeature, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UMLPackage.VARIABLE__EANNOTATIONS :
getEAnnotations().clear();
return;
case UMLPackage.VARIABLE__OWNED_COMMENT :
getOwnedComments().clear();
return;
case UMLPackage.VARIABLE__NAME :
setName(NAME_EDEFAULT);
return;
case UMLPackage.VARIABLE__VISIBILITY :
setVisibility(VISIBILITY_EDEFAULT);
return;
case UMLPackage.VARIABLE__CLIENT_DEPENDENCY :
getClientDependencies().clear();
return;
case UMLPackage.VARIABLE__NAME_EXPRESSION :
setNameExpression((StringExpression) null);
return;
case UMLPackage.VARIABLE__TYPE :
setType((Type) null);
return;
case UMLPackage.VARIABLE__IS_ORDERED :
setIsOrdered(IS_ORDERED_EDEFAULT);
return;
case UMLPackage.VARIABLE__IS_UNIQUE :
setIsUnique(IS_UNIQUE_EDEFAULT);
return;
case UMLPackage.VARIABLE__UPPER :
setUpper(UPPER_EDEFAULT);
return;
case UMLPackage.VARIABLE__LOWER :
setLower(LOWER_EDEFAULT);
return;
case UMLPackage.VARIABLE__UPPER_VALUE :
setUpperValue((ValueSpecification) null);
return;
case UMLPackage.VARIABLE__LOWER_VALUE :
setLowerValue((ValueSpecification) null);
return;
case UMLPackage.VARIABLE__ACTIVITY_SCOPE :
setActivityScope((Activity) null);
return;
case UMLPackage.VARIABLE__SCOPE :
setScope((StructuredActivityNode) null);
return;
}
eDynamicUnset(eFeature);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UMLPackage.VARIABLE__EANNOTATIONS :
return eAnnotations != null && !eAnnotations.isEmpty();
case UMLPackage.VARIABLE__OWNED_ELEMENT :
return isSetOwnedElements();
case UMLPackage.VARIABLE__OWNER :
return isSetOwner();
case UMLPackage.VARIABLE__OWNED_COMMENT :
List ownedComment = (List) eVirtualGet(UMLPackage.VARIABLE__OWNED_COMMENT);
return ownedComment != null && !ownedComment.isEmpty();
case UMLPackage.VARIABLE__NAME :
String name = eVirtualIsSet(UMLPackage.VARIABLE__NAME)
? (String) eVirtualGet(UMLPackage.VARIABLE__NAME)
: NAME_EDEFAULT;
return NAME_EDEFAULT == null
? name != null
: !NAME_EDEFAULT.equals(name);
case UMLPackage.VARIABLE__VISIBILITY :
return eVirtualIsSet(UMLPackage.VARIABLE__VISIBILITY)
&& eVirtualGet(UMLPackage.VARIABLE__VISIBILITY) != VISIBILITY_EDEFAULT;
case UMLPackage.VARIABLE__QUALIFIED_NAME :
return QUALIFIED_NAME_EDEFAULT == null
? getQualifiedName() != null
: !QUALIFIED_NAME_EDEFAULT.equals(getQualifiedName());
case UMLPackage.VARIABLE__CLIENT_DEPENDENCY :
List clientDependency = (List) eVirtualGet(UMLPackage.VARIABLE__CLIENT_DEPENDENCY);
return clientDependency != null && !clientDependency.isEmpty();
case UMLPackage.VARIABLE__NAMESPACE :
return isSetNamespace();
case UMLPackage.VARIABLE__NAME_EXPRESSION :
return eVirtualGet(UMLPackage.VARIABLE__NAME_EXPRESSION) != null;
case UMLPackage.VARIABLE__TYPE :
return eVirtualGet(UMLPackage.VARIABLE__TYPE) != null;
case UMLPackage.VARIABLE__IS_ORDERED :
return ((eFlags & IS_ORDERED_EFLAG) != 0) != IS_ORDERED_EDEFAULT;
case UMLPackage.VARIABLE__IS_UNIQUE :
return ((eFlags & IS_UNIQUE_EFLAG) != 0) != IS_UNIQUE_EDEFAULT;
case UMLPackage.VARIABLE__UPPER :
return getUpper() != UPPER_EDEFAULT;
case UMLPackage.VARIABLE__LOWER :
return getLower() != LOWER_EDEFAULT;
case UMLPackage.VARIABLE__UPPER_VALUE :
return eVirtualGet(UMLPackage.VARIABLE__UPPER_VALUE) != null;
case UMLPackage.VARIABLE__LOWER_VALUE :
return eVirtualGet(UMLPackage.VARIABLE__LOWER_VALUE) != null;
case UMLPackage.VARIABLE__ACTIVITY_SCOPE :
return getActivityScope() != null;
case UMLPackage.VARIABLE__SCOPE :
return getScope() != null;
}
return eDynamicIsSet(eFeature);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) {
if (baseClass == MultiplicityElement.class) {
switch (derivedFeatureID) {
case UMLPackage.VARIABLE__IS_ORDERED :
return UMLPackage.MULTIPLICITY_ELEMENT__IS_ORDERED;
case UMLPackage.VARIABLE__IS_UNIQUE :
return UMLPackage.MULTIPLICITY_ELEMENT__IS_UNIQUE;
case UMLPackage.VARIABLE__UPPER :
return UMLPackage.MULTIPLICITY_ELEMENT__UPPER;
case UMLPackage.VARIABLE__LOWER :
return UMLPackage.MULTIPLICITY_ELEMENT__LOWER;
case UMLPackage.VARIABLE__UPPER_VALUE :
return UMLPackage.MULTIPLICITY_ELEMENT__UPPER_VALUE;
case UMLPackage.VARIABLE__LOWER_VALUE :
return UMLPackage.MULTIPLICITY_ELEMENT__LOWER_VALUE;
default :
return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) {
if (baseClass == MultiplicityElement.class) {
switch (baseFeatureID) {
case UMLPackage.MULTIPLICITY_ELEMENT__IS_ORDERED :
return UMLPackage.VARIABLE__IS_ORDERED;
case UMLPackage.MULTIPLICITY_ELEMENT__IS_UNIQUE :
return UMLPackage.VARIABLE__IS_UNIQUE;
case UMLPackage.MULTIPLICITY_ELEMENT__UPPER :
return UMLPackage.VARIABLE__UPPER;
case UMLPackage.MULTIPLICITY_ELEMENT__LOWER :
return UMLPackage.VARIABLE__LOWER;
case UMLPackage.MULTIPLICITY_ELEMENT__UPPER_VALUE :
return UMLPackage.VARIABLE__UPPER_VALUE;
case UMLPackage.MULTIPLICITY_ELEMENT__LOWER_VALUE :
return UMLPackage.VARIABLE__LOWER_VALUE;
default :
return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy())
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (isOrdered: "); //$NON-NLS-1$
result.append((eFlags & IS_ORDERED_EFLAG) != 0);
result.append(", isUnique: "); //$NON-NLS-1$
result.append((eFlags & IS_UNIQUE_EFLAG) != 0);
result.append(')');
return result.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetOwnedElements() {
return super.isSetOwnedElements()
|| eIsSet(UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue())
|| eIsSet(UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Element basicGetOwner() {
Activity activityScope = getActivityScope();
if (activityScope != null) {
return activityScope;
}
StructuredActivityNode scope = getScope();
if (scope != null) {
return scope;
}
return super.basicGetOwner();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetOwner() {
return super.isSetOwner()
|| eIsSet(UMLPackage.eINSTANCE.getVariable_ActivityScope())
|| eIsSet(UMLPackage.eINSTANCE.getVariable_Scope());
}
} //VariableImpl