blob: e7ba6faf3697de303890b92e1a8df6fdfd5c9899 [file] [log] [blame]
/*
* Copyright (c) 2003, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
*
* $Id: LinkEndCreationDataImpl.java,v 1.3 2004/05/20 03:20:02 khussey Exp $
*/
package org.eclipse.uml2.impl;
import java.util.Collection;
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.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.uml2.InputPin;
import org.eclipse.uml2.LinkEndCreationData;
import org.eclipse.uml2.Property;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.QualifierValue;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Link End Creation Data</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.uml2.impl.LinkEndCreationDataImpl#isReplaceAll <em>Is Replace All</em>}</li>
* <li>{@link org.eclipse.uml2.impl.LinkEndCreationDataImpl#getInsertAt <em>Insert At</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LinkEndCreationDataImpl extends LinkEndDataImpl implements LinkEndCreationData {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "Copyright (c) 2003, 2004 IBM Corporation and others."; //$NON-NLS-1$
/**
* The default value of the '{@link #isReplaceAll() <em>Is Replace All</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isReplaceAll()
* @generated
* @ordered
*/
protected static final boolean IS_REPLACE_ALL_EDEFAULT = false;
/**
* The cached value of the '{@link #isReplaceAll() <em>Is Replace All</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isReplaceAll()
* @generated
* @ordered
*/
protected boolean isReplaceAll = IS_REPLACE_ALL_EDEFAULT;
/**
* The cached value of the '{@link #getInsertAt() <em>Insert At</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInsertAt()
* @generated
* @ordered
*/
protected InputPin insertAt = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LinkEndCreationDataImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return UML2Package.eINSTANCE.getLinkEndCreationData();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isReplaceAll() {
return isReplaceAll;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsReplaceAll(boolean newIsReplaceAll) {
boolean oldIsReplaceAll = isReplaceAll;
isReplaceAll = newIsReplaceAll;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UML2Package.LINK_END_CREATION_DATA__IS_REPLACE_ALL, oldIsReplaceAll, isReplaceAll));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InputPin getInsertAt() {
if (insertAt != null && insertAt.eIsProxy()) {
InputPin oldInsertAt = insertAt;
insertAt = (InputPin)eResolveProxy((InternalEObject)insertAt);
if (insertAt != oldInsertAt) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, UML2Package.LINK_END_CREATION_DATA__INSERT_AT, oldInsertAt, insertAt));
}
}
return insertAt;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InputPin basicGetInsertAt() {
return insertAt;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInsertAt(InputPin newInsertAt) {
InputPin oldInsertAt = insertAt;
insertAt = newInsertAt;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UML2Package.LINK_END_CREATION_DATA__INSERT_AT, oldInsertAt, insertAt));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public EList getQualifiers() {
if (null == qualifier) {
qualifier = new EObjectContainmentEList(QualifierValue.class, this, UML2Package.LINK_END_CREATION_DATA__QUALIFIER);
}
return qualifier;
}
/**
* <!-- 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 UML2Package.LINK_END_CREATION_DATA__EANNOTATIONS:
return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, 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 UML2Package.LINK_END_CREATION_DATA__EANNOTATIONS:
return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs);
case UML2Package.LINK_END_CREATION_DATA__OWNED_COMMENT:
return ((InternalEList)getOwnedComments()).basicRemove(otherEnd, msgs);
case UML2Package.LINK_END_CREATION_DATA__QUALIFIER:
return ((InternalEList)getQualifiers()).basicRemove(otherEnd, msgs);
default:
return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
}
}
return eBasicSetContainer(null, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(EStructuralFeature eFeature, boolean resolve) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UML2Package.LINK_END_CREATION_DATA__EANNOTATIONS:
return getEAnnotations();
case UML2Package.LINK_END_CREATION_DATA__OWNED_ELEMENT:
return getOwnedElements();
case UML2Package.LINK_END_CREATION_DATA__OWNER:
if (resolve) return getOwner();
return basicGetOwner();
case UML2Package.LINK_END_CREATION_DATA__OWNED_COMMENT:
return getOwnedComments();
case UML2Package.LINK_END_CREATION_DATA__VALUE:
if (resolve) return getValue();
return basicGetValue();
case UML2Package.LINK_END_CREATION_DATA__END:
if (resolve) return getEnd();
return basicGetEnd();
case UML2Package.LINK_END_CREATION_DATA__QUALIFIER:
return getQualifiers();
case UML2Package.LINK_END_CREATION_DATA__IS_REPLACE_ALL:
return isReplaceAll() ? Boolean.TRUE : Boolean.FALSE;
case UML2Package.LINK_END_CREATION_DATA__INSERT_AT:
if (resolve) return getInsertAt();
return basicGetInsertAt();
}
return eDynamicGet(eFeature, resolve);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(EStructuralFeature eFeature, Object newValue) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UML2Package.LINK_END_CREATION_DATA__EANNOTATIONS:
getEAnnotations().clear();
getEAnnotations().addAll((Collection)newValue);
return;
case UML2Package.LINK_END_CREATION_DATA__OWNED_COMMENT:
getOwnedComments().clear();
getOwnedComments().addAll((Collection)newValue);
return;
case UML2Package.LINK_END_CREATION_DATA__VALUE:
setValue((InputPin)newValue);
return;
case UML2Package.LINK_END_CREATION_DATA__END:
setEnd((Property)newValue);
return;
case UML2Package.LINK_END_CREATION_DATA__QUALIFIER:
getQualifiers().clear();
getQualifiers().addAll((Collection)newValue);
return;
case UML2Package.LINK_END_CREATION_DATA__IS_REPLACE_ALL:
setIsReplaceAll(((Boolean)newValue).booleanValue());
return;
case UML2Package.LINK_END_CREATION_DATA__INSERT_AT:
setInsertAt((InputPin)newValue);
return;
}
eDynamicSet(eFeature, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UML2Package.LINK_END_CREATION_DATA__EANNOTATIONS:
getEAnnotations().clear();
return;
case UML2Package.LINK_END_CREATION_DATA__OWNED_COMMENT:
getOwnedComments().clear();
return;
case UML2Package.LINK_END_CREATION_DATA__VALUE:
setValue((InputPin)null);
return;
case UML2Package.LINK_END_CREATION_DATA__END:
setEnd((Property)null);
return;
case UML2Package.LINK_END_CREATION_DATA__QUALIFIER:
getQualifiers().clear();
return;
case UML2Package.LINK_END_CREATION_DATA__IS_REPLACE_ALL:
setIsReplaceAll(IS_REPLACE_ALL_EDEFAULT);
return;
case UML2Package.LINK_END_CREATION_DATA__INSERT_AT:
setInsertAt((InputPin)null);
return;
}
eDynamicUnset(eFeature);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(EStructuralFeature eFeature) {
switch (eDerivedStructuralFeatureID(eFeature)) {
case UML2Package.LINK_END_CREATION_DATA__EANNOTATIONS:
return eAnnotations != null && !eAnnotations.isEmpty();
case UML2Package.LINK_END_CREATION_DATA__OWNED_ELEMENT:
return !getOwnedElements().isEmpty();
case UML2Package.LINK_END_CREATION_DATA__OWNER:
return basicGetOwner() != null;
case UML2Package.LINK_END_CREATION_DATA__OWNED_COMMENT:
return ownedComment != null && !ownedComment.isEmpty();
case UML2Package.LINK_END_CREATION_DATA__VALUE:
return value != null;
case UML2Package.LINK_END_CREATION_DATA__END:
return end != null;
case UML2Package.LINK_END_CREATION_DATA__QUALIFIER:
return qualifier != null && !qualifier.isEmpty();
case UML2Package.LINK_END_CREATION_DATA__IS_REPLACE_ALL:
return isReplaceAll != IS_REPLACE_ALL_EDEFAULT;
case UML2Package.LINK_END_CREATION_DATA__INSERT_AT:
return insertAt != null;
}
return eDynamicIsSet(eFeature);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (isReplaceAll: "); //$NON-NLS-1$
result.append(isReplaceAll);
result.append(')');
return result.toString();
}
} //LinkEndCreationDataImpl