| //------------------------------------------------------------------------------ |
| // 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 Corporation - initial implementation |
| //------------------------------------------------------------------------------ |
| package org.eclipse.epf.uma.impl; |
| |
| import java.util.Collection; |
| import java.util.List; |
| |
| 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.epf.uma.Point; |
| import org.eclipse.epf.uma.Polyline; |
| import org.eclipse.epf.uma.UmaPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Polyline</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.epf.uma.impl.PolylineImpl#getClosed <em>Closed</em>}</li> |
| * <li>{@link org.eclipse.epf.uma.impl.PolylineImpl#getWaypoints <em>Waypoints</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class PolylineImpl extends GraphicPrimitiveImpl implements Polyline { |
| /** |
| * The default value of the '{@link #getClosed() <em>Closed</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClosed() |
| * @generated |
| * @ordered |
| */ |
| protected static final Boolean CLOSED_EDEFAULT = Boolean.TRUE; |
| |
| /** |
| * The cached value of the '{@link #getClosed() <em>Closed</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClosed() |
| * @generated |
| * @ordered |
| */ |
| protected Boolean closed = CLOSED_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getWaypoints() <em>Waypoints</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getWaypoints() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Point> waypoints; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PolylineImpl() { |
| super(); |
| |
| //UMA--> |
| reassignDefaultValues(); |
| //UMA<-- |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UmaPackage.Literals.POLYLINE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Boolean getClosed() { |
| return closed; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setClosed(Boolean newClosed) { |
| Boolean oldClosed = closed; |
| closed = newClosed; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, |
| UmaPackage.POLYLINE__CLOSED, oldClosed, closed)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public List<Point> getWaypoints() { |
| if (waypoints == null) { |
| waypoints = new EObjectContainmentEList.Resolving<Point>( |
| Point.class, this, UmaPackage.POLYLINE__WAYPOINTS); |
| } |
| return waypoints; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case UmaPackage.POLYLINE__WAYPOINTS: |
| return ((InternalEList<?>) getWaypoints()).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 UmaPackage.POLYLINE__CLOSED: |
| return getClosed(); |
| case UmaPackage.POLYLINE__WAYPOINTS: |
| return getWaypoints(); |
| } |
| 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 UmaPackage.POLYLINE__CLOSED: |
| setClosed((Boolean) newValue); |
| return; |
| case UmaPackage.POLYLINE__WAYPOINTS: |
| getWaypoints().clear(); |
| getWaypoints().addAll((Collection<? extends Point>) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case UmaPackage.POLYLINE__CLOSED: |
| setClosed(CLOSED_EDEFAULT); |
| return; |
| case UmaPackage.POLYLINE__WAYPOINTS: |
| getWaypoints().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| //UMA--> |
| EStructuralFeature feature = getFeatureWithOverridenDefaultValue(featureID); |
| if (feature != null) { |
| return isFeatureWithOverridenDefaultValueSet(feature); |
| } |
| //UMA<-- |
| switch (featureID) { |
| case UmaPackage.POLYLINE__CLOSED: |
| return CLOSED_EDEFAULT == null ? closed != null : !CLOSED_EDEFAULT |
| .equals(closed); |
| case UmaPackage.POLYLINE__WAYPOINTS: |
| return waypoints != null && !waypoints.isEmpty(); |
| } |
| 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(" (closed: "); //$NON-NLS-1$ |
| result.append(closed); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //PolylineImpl |