blob: 456b2e5d938d3d371973012eff3e7aa1f3180889 [file] [log] [blame]
/*
* 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: RelationshipImpl.java,v 1.10 2006/05/24 20:54:27 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.impl;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.uml2.common.util.CacheAdapter;
import org.eclipse.uml2.common.util.DerivedUnionEObjectEList;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Relationship;
import org.eclipse.uml2.uml.UMLPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Relationship</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.uml2.uml.internal.impl.RelationshipImpl#getRelatedElements <em>Related Element</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class RelationshipImpl
extends ElementImpl
implements Relationship {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RelationshipImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return UMLPackage.Literals.RELATIONSHIP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getRelatedElements() {
CacheAdapter cache = getCacheAdapter();
if (cache != null) {
Resource eResource = eResource();
EList relatedElements = (EList) cache.get(eResource, this,
UMLPackage.Literals.RELATIONSHIP__RELATED_ELEMENT);
if (relatedElements == null) {
cache.put(eResource, this,
UMLPackage.Literals.RELATIONSHIP__RELATED_ELEMENT,
relatedElements = new DerivedUnionEObjectEList(
Element.class, this,
UMLPackage.RELATIONSHIP__RELATED_ELEMENT, null));
}
return relatedElements;
}
return new DerivedUnionEObjectEList(Element.class, this,
UMLPackage.RELATIONSHIP__RELATED_ELEMENT, null);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case UMLPackage.RELATIONSHIP__EANNOTATIONS :
return getEAnnotations();
case UMLPackage.RELATIONSHIP__OWNED_ELEMENT :
return getOwnedElements();
case UMLPackage.RELATIONSHIP__OWNER :
if (resolve)
return getOwner();
return basicGetOwner();
case UMLPackage.RELATIONSHIP__OWNED_COMMENT :
return getOwnedComments();
case UMLPackage.RELATIONSHIP__RELATED_ELEMENT :
return getRelatedElements();
}
return eDynamicGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case UMLPackage.RELATIONSHIP__EANNOTATIONS :
return eAnnotations != null && !eAnnotations.isEmpty();
case UMLPackage.RELATIONSHIP__OWNED_ELEMENT :
return isSetOwnedElements();
case UMLPackage.RELATIONSHIP__OWNER :
return isSetOwner();
case UMLPackage.RELATIONSHIP__OWNED_COMMENT :
return ownedComments != null && !ownedComments.isEmpty();
case UMLPackage.RELATIONSHIP__RELATED_ELEMENT :
return isSetRelatedElements();
}
return eDynamicIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetRelatedElements() {
return false;
}
} //RelationshipImpl