blob: 69f8afef3306c2150916dfc03489782dc65aa4e5 [file] [log] [blame]
/**
* Copyright (c) 2000-2009, Intalio Inc.
* 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:
* Intalio Inc. - initial API and implementation
*
*/
package org.eclipse.mdt.bpmn.di.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.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.mdt.bpmn.di.Bendpoint;
import org.eclipse.mdt.bpmn.di.Connector;
import org.eclipse.mdt.bpmn.di.DIPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Connector</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.mdt.bpmn.di.impl.ConnectorImpl#getBendpoint <em>Bendpoint</em>}</li>
* <li>{@link org.eclipse.mdt.bpmn.di.impl.ConnectorImpl#getSource <em>Source</em>}</li>
* <li>{@link org.eclipse.mdt.bpmn.di.impl.ConnectorImpl#getTarget <em>Target</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConnectorImpl extends ViewImpl implements Connector {
/**
* The cached value of the '{@link #getBendpoint() <em>Bendpoint</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBendpoint()
* @generated
* @ordered
*/
protected EList<Bendpoint> bendpoint;
/**
* The default value of the '{@link #getSource() <em>Source</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected static final String SOURCE_EDEFAULT = null;
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected String source = SOURCE_EDEFAULT;
/**
* The default value of the '{@link #getTarget() <em>Target</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected static final String TARGET_EDEFAULT = null;
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected String target = TARGET_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConnectorImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DIPackage.Literals.CONNECTOR;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Bendpoint> getBendpoint() {
if (bendpoint == null) {
bendpoint = new EObjectContainmentEList<Bendpoint>(Bendpoint.class,
this, DIPackage.CONNECTOR__BENDPOINT);
}
return bendpoint;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getSource() {
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(String newSource) {
String oldSource = source;
source = newSource;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
DIPackage.CONNECTOR__SOURCE, oldSource, source));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTarget(String newTarget) {
String oldTarget = target;
target = newTarget;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
DIPackage.CONNECTOR__TARGET, oldTarget, target));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case DIPackage.CONNECTOR__BENDPOINT:
return ((InternalEList<?>) getBendpoint()).basicRemove(otherEnd,
msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case DIPackage.CONNECTOR__BENDPOINT:
return getBendpoint();
case DIPackage.CONNECTOR__SOURCE:
return getSource();
case DIPackage.CONNECTOR__TARGET:
return getTarget();
}
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 DIPackage.CONNECTOR__BENDPOINT:
getBendpoint().clear();
getBendpoint().addAll((Collection<? extends Bendpoint>) newValue);
return;
case DIPackage.CONNECTOR__SOURCE:
setSource((String) newValue);
return;
case DIPackage.CONNECTOR__TARGET:
setTarget((String) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DIPackage.CONNECTOR__BENDPOINT:
getBendpoint().clear();
return;
case DIPackage.CONNECTOR__SOURCE:
setSource(SOURCE_EDEFAULT);
return;
case DIPackage.CONNECTOR__TARGET:
setTarget(TARGET_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DIPackage.CONNECTOR__BENDPOINT:
return bendpoint != null && !bendpoint.isEmpty();
case DIPackage.CONNECTOR__SOURCE:
return SOURCE_EDEFAULT == null ? source != null : !SOURCE_EDEFAULT
.equals(source);
case DIPackage.CONNECTOR__TARGET:
return TARGET_EDEFAULT == null ? target != null : !TARGET_EDEFAULT
.equals(target);
}
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(" (source: "); //$NON-NLS-1$
result.append(source);
result.append(", target: "); //$NON-NLS-1$
result.append(target);
result.append(')');
return result.toString();
}
} //ConnectorImpl