blob: 94eca001ea234ca3d43c9f79f76cb251b60368ce [file] [log] [blame]
/**
*/
package org.eclipse.papyrus.bpmn.BPMNProfile.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.papyrus.bpmn.BPMNProfile.BPMNProfilePackage;
import org.eclipse.papyrus.bpmn.BPMNProfile.BPMNRelationship;
import org.eclipse.papyrus.bpmn.BPMNProfile.Definitions;
import org.eclipse.papyrus.bpmn.BPMNProfile.RelationshipDirection;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Element;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>BPMN Relationship</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.BPMNRelationshipImpl#getBase_Constraint <em>Base Constraint</em>}</li>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.BPMNRelationshipImpl#getType <em>Type</em>}</li>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.BPMNRelationshipImpl#getDirection <em>Direction</em>}</li>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.BPMNRelationshipImpl#getTargets <em>Targets</em>}</li>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.BPMNRelationshipImpl#getSources <em>Sources</em>}</li>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.BPMNRelationshipImpl#getDefinition <em>Definition</em>}</li>
* </ul>
*
* @generated
*/
public class BPMNRelationshipImpl extends BaseElementImpl implements BPMNRelationship {
/**
* The cached value of the '{@link #getBase_Constraint() <em>Base Constraint</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase_Constraint()
* @generated
* @ordered
*/
protected Constraint base_Constraint;
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected static final String TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected String type = TYPE_EDEFAULT;
/**
* The default value of the '{@link #getDirection() <em>Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
* @generated
* @ordered
*/
protected static final RelationshipDirection DIRECTION_EDEFAULT = RelationshipDirection.NONE;
/**
* The cached value of the '{@link #getDirection() <em>Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
* @generated
* @ordered
*/
protected RelationshipDirection direction = DIRECTION_EDEFAULT;
/**
* The cached value of the '{@link #getTargets() <em>Targets</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTargets()
* @generated
* @ordered
*/
protected EList<Element> targets;
/**
* The cached value of the '{@link #getSources() <em>Sources</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSources()
* @generated
* @ordered
*/
protected EList<Element> sources;
/**
* The cached value of the '{@link #getDefinition() <em>Definition</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefinition()
* @generated
* @ordered
*/
protected Definitions definition;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BPMNRelationshipImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BPMNProfilePackage.eINSTANCE.getBPMNRelationship();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Constraint getBase_Constraint() {
if (base_Constraint != null && base_Constraint.eIsProxy()) {
InternalEObject oldBase_Constraint = (InternalEObject)base_Constraint;
base_Constraint = (Constraint)eResolveProxy(oldBase_Constraint);
if (base_Constraint != oldBase_Constraint) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, BPMNProfilePackage.BPMN_RELATIONSHIP__BASE_CONSTRAINT, oldBase_Constraint, base_Constraint));
}
}
return base_Constraint;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Constraint basicGetBase_Constraint() {
return base_Constraint;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBase_Constraint(Constraint newBase_Constraint) {
Constraint oldBase_Constraint = base_Constraint;
base_Constraint = newBase_Constraint;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BPMNProfilePackage.BPMN_RELATIONSHIP__BASE_CONSTRAINT, oldBase_Constraint, base_Constraint));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(String newType) {
String oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BPMNProfilePackage.BPMN_RELATIONSHIP__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public RelationshipDirection getDirection() {
return direction;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDirection(RelationshipDirection newDirection) {
RelationshipDirection oldDirection = direction;
direction = newDirection == null ? DIRECTION_EDEFAULT : newDirection;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BPMNProfilePackage.BPMN_RELATIONSHIP__DIRECTION, oldDirection, direction));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Element> getTargets() {
if (targets == null) {
targets = new EObjectResolvingEList<Element>(Element.class, this, BPMNProfilePackage.BPMN_RELATIONSHIP__TARGETS);
}
return targets;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Element> getSources() {
if (sources == null) {
sources = new EObjectResolvingEList<Element>(Element.class, this, BPMNProfilePackage.BPMN_RELATIONSHIP__SOURCES);
}
return sources;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Definitions getDefinition() {
if (definition != null && definition.eIsProxy()) {
InternalEObject oldDefinition = (InternalEObject)definition;
definition = (Definitions)eResolveProxy(oldDefinition);
if (definition != oldDefinition) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, BPMNProfilePackage.BPMN_RELATIONSHIP__DEFINITION, oldDefinition, definition));
}
}
return definition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Definitions basicGetDefinition() {
return definition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDefinition(Definitions newDefinition) {
Definitions oldDefinition = definition;
definition = newDefinition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BPMNProfilePackage.BPMN_RELATIONSHIP__DEFINITION, oldDefinition, definition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BPMNProfilePackage.BPMN_RELATIONSHIP__BASE_CONSTRAINT:
if (resolve) return getBase_Constraint();
return basicGetBase_Constraint();
case BPMNProfilePackage.BPMN_RELATIONSHIP__TYPE:
return getType();
case BPMNProfilePackage.BPMN_RELATIONSHIP__DIRECTION:
return getDirection();
case BPMNProfilePackage.BPMN_RELATIONSHIP__TARGETS:
return getTargets();
case BPMNProfilePackage.BPMN_RELATIONSHIP__SOURCES:
return getSources();
case BPMNProfilePackage.BPMN_RELATIONSHIP__DEFINITION:
if (resolve) return getDefinition();
return basicGetDefinition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case BPMNProfilePackage.BPMN_RELATIONSHIP__BASE_CONSTRAINT:
setBase_Constraint((Constraint)newValue);
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__TYPE:
setType((String)newValue);
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__DIRECTION:
setDirection((RelationshipDirection)newValue);
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__TARGETS:
getTargets().clear();
getTargets().addAll((Collection<? extends Element>)newValue);
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__SOURCES:
getSources().clear();
getSources().addAll((Collection<? extends Element>)newValue);
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__DEFINITION:
setDefinition((Definitions)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BPMNProfilePackage.BPMN_RELATIONSHIP__BASE_CONSTRAINT:
setBase_Constraint((Constraint)null);
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__TYPE:
setType(TYPE_EDEFAULT);
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__DIRECTION:
setDirection(DIRECTION_EDEFAULT);
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__TARGETS:
getTargets().clear();
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__SOURCES:
getSources().clear();
return;
case BPMNProfilePackage.BPMN_RELATIONSHIP__DEFINITION:
setDefinition((Definitions)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BPMNProfilePackage.BPMN_RELATIONSHIP__BASE_CONSTRAINT:
return base_Constraint != null;
case BPMNProfilePackage.BPMN_RELATIONSHIP__TYPE:
return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
case BPMNProfilePackage.BPMN_RELATIONSHIP__DIRECTION:
return direction != DIRECTION_EDEFAULT;
case BPMNProfilePackage.BPMN_RELATIONSHIP__TARGETS:
return targets != null && !targets.isEmpty();
case BPMNProfilePackage.BPMN_RELATIONSHIP__SOURCES:
return sources != null && !sources.isEmpty();
case BPMNProfilePackage.BPMN_RELATIONSHIP__DEFINITION:
return definition != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (type: ");
result.append(type);
result.append(", direction: ");
result.append(direction);
result.append(')');
return result.toString();
}
} //BPMNRelationshipImpl