blob: 6a0b872eb3ce471b1252a0cf223d8b87667810a0 [file] [log] [blame]
/******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
****************************************************************************/
package org.eclipse.gmf.runtime.notation.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
/**
* <!-- begin-user-doc --> An implementation of the model object
* '<em><b>Relative Bendpoints</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.gmf.runtime.notation.impl.RelativeBendpointsImpl#getPoints
* <em>Points</em>}</li>
* </ul>
*
* @generated
*/
/*
* @canBeSeenBy %partners
*/
public class RelativeBendpointsImpl extends MinimalEObjectImpl.Container implements RelativeBendpoints {
/**
* The default value of the '{@link #getPoints() <em>Points</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getPoints()
* @generated NOT
* @ordered
*/
protected static final List POINTS_EDEFAULT = Collections.EMPTY_LIST;
/**
* The cached value of the '{@link #getPoints() <em>Points</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getPoints()
* @generated
* @ordered
*/
protected List points = POINTS_EDEFAULT;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected RelativeBendpointsImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected EClass eStaticClass() {
return NotationPackage.Literals.RELATIVE_BENDPOINTS;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
public List getPoints() {
return Collections.unmodifiableList(getPointsGen());
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public List getPointsGen() {
return points;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
public void setPoints(List newPoints) {
if (newPoints == null)
throw new NullPointerException("the 'newPoints' parameter is null"); //$NON-NLS-1$
if (newPoints.isEmpty())
setPointsGen(POINTS_EDEFAULT);
else {
List tempList = new ArrayList(newPoints.size());
for (Iterator i = newPoints.iterator(); i.hasNext();) {
Object point = i.next();
if (!(point instanceof RelativeBendpoint))
throw new IllegalArgumentException(
"One or more objects in the list is not of type org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint"); //$NON-NLS-1$
tempList.add(point);
}
setPointsGen(tempList);
}
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void setPointsGen(List newPoints) {
List oldPoints = points;
points = newPoints;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NotationPackage.RELATIVE_BENDPOINTS__POINTS,
oldPoints, points));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case NotationPackage.RELATIVE_BENDPOINTS__POINTS:
return getPoints();
}
return eDynamicGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case NotationPackage.RELATIVE_BENDPOINTS__POINTS:
setPoints((List) newValue);
return;
}
eDynamicSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case NotationPackage.RELATIVE_BENDPOINTS__POINTS:
setPoints(POINTS_EDEFAULT);
return;
}
eDynamicUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case NotationPackage.RELATIVE_BENDPOINTS__POINTS:
return POINTS_EDEFAULT == null ? points != null : !POINTS_EDEFAULT.equals(points);
}
return eDynamicIsSet(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public String toString() {
if (eIsProxy())
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (points: "); //$NON-NLS-1$
result.append(points);
result.append(')');
return result.toString();
}
} // RelativeBendpointsImpl