| /* |
| * Copyright (c) 2005, 2007 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: InstanceValueImpl.java,v 1.16 2007/04/25 17:47:03 khussey Exp $ |
| */ |
| package org.eclipse.uml2.uml.internal.impl; |
| |
| import java.util.Collection; |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EAnnotation; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.uml2.uml.Comment; |
| import org.eclipse.uml2.uml.Dependency; |
| import org.eclipse.uml2.uml.InstanceSpecification; |
| import org.eclipse.uml2.uml.InstanceValue; |
| import org.eclipse.uml2.uml.StringExpression; |
| import org.eclipse.uml2.uml.TemplateParameter; |
| import org.eclipse.uml2.uml.Type; |
| import org.eclipse.uml2.uml.UMLPackage; |
| import org.eclipse.uml2.uml.VisibilityKind; |
| |
| import org.eclipse.uml2.uml.internal.operations.InstanceValueOperations; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Instance Value</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.uml2.uml.internal.impl.InstanceValueImpl#getInstance <em>Instance</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class InstanceValueImpl |
| extends ValueSpecificationImpl |
| implements InstanceValue { |
| |
| /** |
| * The cached value of the '{@link #getInstance() <em>Instance</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getInstance() |
| * @generated |
| * @ordered |
| */ |
| protected InstanceSpecification instance; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected InstanceValueImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UMLPackage.Literals.INSTANCE_VALUE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public InstanceSpecification getInstance() { |
| if (instance != null && instance.eIsProxy()) { |
| InternalEObject oldInstance = (InternalEObject) instance; |
| instance = (InstanceSpecification) eResolveProxy(oldInstance); |
| if (instance != oldInstance) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, |
| UMLPackage.INSTANCE_VALUE__INSTANCE, oldInstance, |
| instance)); |
| } |
| } |
| return instance; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public InstanceSpecification basicGetInstance() { |
| return instance; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setInstance(InstanceSpecification newInstance) { |
| InstanceSpecification oldInstance = instance; |
| instance = newInstance; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, |
| UMLPackage.INSTANCE_VALUE__INSTANCE, oldInstance, instance)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String stringValue() { |
| return InstanceValueOperations.stringValue(this); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case UMLPackage.INSTANCE_VALUE__EANNOTATIONS : |
| return getEAnnotations(); |
| case UMLPackage.INSTANCE_VALUE__OWNED_ELEMENT : |
| return getOwnedElements(); |
| case UMLPackage.INSTANCE_VALUE__OWNER : |
| if (resolve) |
| return getOwner(); |
| return basicGetOwner(); |
| case UMLPackage.INSTANCE_VALUE__OWNED_COMMENT : |
| return getOwnedComments(); |
| case UMLPackage.INSTANCE_VALUE__NAME : |
| return getName(); |
| case UMLPackage.INSTANCE_VALUE__VISIBILITY : |
| return getVisibility(); |
| case UMLPackage.INSTANCE_VALUE__QUALIFIED_NAME : |
| return getQualifiedName(); |
| case UMLPackage.INSTANCE_VALUE__CLIENT_DEPENDENCY : |
| return getClientDependencies(); |
| case UMLPackage.INSTANCE_VALUE__NAMESPACE : |
| if (resolve) |
| return getNamespace(); |
| return basicGetNamespace(); |
| case UMLPackage.INSTANCE_VALUE__NAME_EXPRESSION : |
| if (resolve) |
| return getNameExpression(); |
| return basicGetNameExpression(); |
| case UMLPackage.INSTANCE_VALUE__OWNING_TEMPLATE_PARAMETER : |
| if (resolve) |
| return getOwningTemplateParameter(); |
| return basicGetOwningTemplateParameter(); |
| case UMLPackage.INSTANCE_VALUE__TEMPLATE_PARAMETER : |
| if (resolve) |
| return getTemplateParameter(); |
| return basicGetTemplateParameter(); |
| case UMLPackage.INSTANCE_VALUE__TYPE : |
| if (resolve) |
| return getType(); |
| return basicGetType(); |
| case UMLPackage.INSTANCE_VALUE__INSTANCE : |
| if (resolve) |
| return getInstance(); |
| return basicGetInstance(); |
| } |
| return eDynamicGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case UMLPackage.INSTANCE_VALUE__EANNOTATIONS : |
| getEAnnotations().clear(); |
| getEAnnotations().addAll( |
| (Collection<? extends EAnnotation>) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__OWNED_COMMENT : |
| getOwnedComments().clear(); |
| getOwnedComments().addAll( |
| (Collection<? extends Comment>) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__NAME : |
| setName((String) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__VISIBILITY : |
| setVisibility((VisibilityKind) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__CLIENT_DEPENDENCY : |
| getClientDependencies().clear(); |
| getClientDependencies().addAll( |
| (Collection<? extends Dependency>) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__NAME_EXPRESSION : |
| setNameExpression((StringExpression) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__OWNING_TEMPLATE_PARAMETER : |
| setOwningTemplateParameter((TemplateParameter) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__TEMPLATE_PARAMETER : |
| setTemplateParameter((TemplateParameter) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__TYPE : |
| setType((Type) newValue); |
| return; |
| case UMLPackage.INSTANCE_VALUE__INSTANCE : |
| setInstance((InstanceSpecification) newValue); |
| return; |
| } |
| eDynamicSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case UMLPackage.INSTANCE_VALUE__EANNOTATIONS : |
| getEAnnotations().clear(); |
| return; |
| case UMLPackage.INSTANCE_VALUE__OWNED_COMMENT : |
| getOwnedComments().clear(); |
| return; |
| case UMLPackage.INSTANCE_VALUE__NAME : |
| unsetName(); |
| return; |
| case UMLPackage.INSTANCE_VALUE__VISIBILITY : |
| unsetVisibility(); |
| return; |
| case UMLPackage.INSTANCE_VALUE__CLIENT_DEPENDENCY : |
| getClientDependencies().clear(); |
| return; |
| case UMLPackage.INSTANCE_VALUE__NAME_EXPRESSION : |
| setNameExpression((StringExpression) null); |
| return; |
| case UMLPackage.INSTANCE_VALUE__OWNING_TEMPLATE_PARAMETER : |
| setOwningTemplateParameter((TemplateParameter) null); |
| return; |
| case UMLPackage.INSTANCE_VALUE__TEMPLATE_PARAMETER : |
| setTemplateParameter((TemplateParameter) null); |
| return; |
| case UMLPackage.INSTANCE_VALUE__TYPE : |
| setType((Type) null); |
| return; |
| case UMLPackage.INSTANCE_VALUE__INSTANCE : |
| setInstance((InstanceSpecification) null); |
| return; |
| } |
| eDynamicUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case UMLPackage.INSTANCE_VALUE__EANNOTATIONS : |
| return eAnnotations != null && !eAnnotations.isEmpty(); |
| case UMLPackage.INSTANCE_VALUE__OWNED_ELEMENT : |
| return isSetOwnedElements(); |
| case UMLPackage.INSTANCE_VALUE__OWNER : |
| return isSetOwner(); |
| case UMLPackage.INSTANCE_VALUE__OWNED_COMMENT : |
| return ownedComments != null && !ownedComments.isEmpty(); |
| case UMLPackage.INSTANCE_VALUE__NAME : |
| return isSetName(); |
| case UMLPackage.INSTANCE_VALUE__VISIBILITY : |
| return isSetVisibility(); |
| case UMLPackage.INSTANCE_VALUE__QUALIFIED_NAME : |
| return QUALIFIED_NAME_EDEFAULT == null |
| ? getQualifiedName() != null |
| : !QUALIFIED_NAME_EDEFAULT.equals(getQualifiedName()); |
| case UMLPackage.INSTANCE_VALUE__CLIENT_DEPENDENCY : |
| return clientDependencies != null |
| && !clientDependencies.isEmpty(); |
| case UMLPackage.INSTANCE_VALUE__NAMESPACE : |
| return isSetNamespace(); |
| case UMLPackage.INSTANCE_VALUE__NAME_EXPRESSION : |
| return nameExpression != null; |
| case UMLPackage.INSTANCE_VALUE__OWNING_TEMPLATE_PARAMETER : |
| return basicGetOwningTemplateParameter() != null; |
| case UMLPackage.INSTANCE_VALUE__TEMPLATE_PARAMETER : |
| return templateParameter != null; |
| case UMLPackage.INSTANCE_VALUE__TYPE : |
| return type != null; |
| case UMLPackage.INSTANCE_VALUE__INSTANCE : |
| return instance != null; |
| } |
| return eDynamicIsSet(featureID); |
| } |
| |
| } //InstanceValueImpl |