diff options
author | Eike Stepper | 2010-02-22 17:19:30 +0000 |
---|---|---|
committer | Eike Stepper | 2010-02-22 17:19:30 +0000 |
commit | 1f0016c2452280a27b7360ff03826b00177457c5 (patch) | |
tree | b68d00b92e222b40683405d0184a1889ba6d6449 /plugins/org.eclipse.emf.cdo.tests.model3 | |
parent | 84dbbacea826fdd7158fd401b79c2ff3ca1a1ef2 (diff) | |
download | cdo-1f0016c2452280a27b7360ff03826b00177457c5.tar.gz cdo-1f0016c2452280a27b7360ff03826b00177457c5.tar.xz cdo-1f0016c2452280a27b7360ff03826b00177457c5.zip |
[303502] Problem with CDOStore's contains() method for custom EDataType objects
https://bugs.eclipse.org/bugs/show_bug.cgi?id=303502
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests.model3')
17 files changed, 676 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore b/plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore index 1e9f7d2eed..b03a413c2a 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore +++ b/plugins/org.eclipse.emf.cdo.tests.model3/model/model3.ecore @@ -15,6 +15,10 @@ <eStructuralFeatures xsi:type="ecore:EAttribute" name="points" lowerBound="1" upperBound="-1" eType="#//Point"/> </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="PolygonWithDuplicates"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="points" unique="false" + lowerBound="1" upperBound="-1" eType="#//Point"/> + </eClassifiers> <eSubpackages name="subpackage" nsURI="http://www.eclipse.org/emf/CDO/tests/subpackage/1.0.0" nsPrefix="subpackage"> <eClassifiers xsi:type="ecore:EClass" name="Class2"> diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/Model3Factory.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/Model3Factory.java index e7477b4f9f..3b3b49c693 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/Model3Factory.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/Model3Factory.java @@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.tests.legacy.model3; import org.eclipse.emf.cdo.tests.model3.Class1; import org.eclipse.emf.cdo.tests.model3.MetaRef; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; /** * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a create method for each non-abstract class of @@ -55,6 +56,14 @@ public interface Model3Factory extends org.eclipse.emf.cdo.tests.model3.Model3Fa Polygon createPolygon(); /** + * Returns a new object of class '<em>Polygon With Duplicates</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return a new object of class '<em>Polygon With Duplicates</em>'. + * @generated + */ + PolygonWithDuplicates createPolygonWithDuplicates(); + + /** * Returns the package supported by this factory. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the package supported by this factory. diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/Model3Package.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/Model3Package.java index 4b33231c96..e9271fa2ac 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/Model3Package.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/Model3Package.java @@ -138,13 +138,40 @@ public interface Model3Package extends org.eclipse.emf.cdo.tests.model3.Model3Pa int POLYGON_FEATURE_COUNT = 1; /** + * The meta object id for the '{@link org.eclipse.emf.cdo.tests.legacy.model3.impl.PolygonWithDuplicatesImpl + * <em>Polygon With Duplicates</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.emf.cdo.tests.legacy.model3.impl.PolygonWithDuplicatesImpl + * @see org.eclipse.emf.cdo.tests.legacy.model3.impl.Model3PackageImpl#getPolygonWithDuplicates() + * @generated + */ + int POLYGON_WITH_DUPLICATES = 3; + + /** + * The feature id for the '<em><b>Points</b></em>' attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int POLYGON_WITH_DUPLICATES__POINTS = 0; + + /** + * The number of structural features of the '<em>Polygon With Duplicates</em>' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int POLYGON_WITH_DUPLICATES_FEATURE_COUNT = 1; + + /** * The meta object id for the '<em>Point</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see org.eclipse.emf.cdo.tests.model3.Point * @see org.eclipse.emf.cdo.tests.legacy.model3.impl.Model3PackageImpl#getPoint() * @generated */ - int POINT = 3; + int POINT = 4; /** * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.legacy.model3.Class1 <em>Class1</em>}'. <!-- @@ -210,6 +237,28 @@ public interface Model3Package extends org.eclipse.emf.cdo.tests.model3.Model3Pa EAttribute getPolygon_Points(); /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.legacy.model3.PolygonWithDuplicates + * <em>Polygon With Duplicates</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for class '<em>Polygon With Duplicates</em>'. + * @see org.eclipse.emf.cdo.tests.legacy.model3.PolygonWithDuplicates + * @generated + */ + EClass getPolygonWithDuplicates(); + + /** + * Returns the meta object for the attribute list ' + * {@link org.eclipse.emf.cdo.tests.legacy.model3.PolygonWithDuplicates#getPoints <em>Points</em>}'. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for the attribute list '<em>Points</em>'. + * @see org.eclipse.emf.cdo.tests.legacy.model3.PolygonWithDuplicates#getPoints() + * @see #getPolygonWithDuplicates() + * @generated + */ + EAttribute getPolygonWithDuplicates_Points(); + + /** * Returns the meta object for data type '{@link org.eclipse.emf.cdo.tests.model3.Point <em>Point</em>}'. <!-- * begin-user-doc --> <!-- end-user-doc --> * @@ -297,6 +346,24 @@ public interface Model3Package extends org.eclipse.emf.cdo.tests.model3.Model3Pa EAttribute POLYGON__POINTS = eINSTANCE.getPolygon_Points(); /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.legacy.model3.impl.PolygonWithDuplicatesImpl + * <em>Polygon With Duplicates</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.emf.cdo.tests.legacy.model3.impl.PolygonWithDuplicatesImpl + * @see org.eclipse.emf.cdo.tests.legacy.model3.impl.Model3PackageImpl#getPolygonWithDuplicates() + * @generated + */ + EClass POLYGON_WITH_DUPLICATES = eINSTANCE.getPolygonWithDuplicates(); + + /** + * The meta object literal for the '<em><b>Points</b></em>' attribute list feature. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + EAttribute POLYGON_WITH_DUPLICATES__POINTS = eINSTANCE.getPolygonWithDuplicates_Points(); + + /** * The meta object literal for the '<em>Point</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see org.eclipse.emf.cdo.tests.model3.Point diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3FactoryImpl.java index f3f9bc8d8d..cc42652361 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3FactoryImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3FactoryImpl.java @@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.tests.model3.Class1; import org.eclipse.emf.cdo.tests.model3.MetaRef; import org.eclipse.emf.cdo.tests.model3.Point; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; @@ -80,6 +81,8 @@ public class Model3FactoryImpl extends EFactoryImpl implements Model3Factory return createMetaRef(); case Model3Package.POLYGON: return createPolygon(); + case Model3Package.POLYGON_WITH_DUPLICATES: + return createPolygonWithDuplicates(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -157,6 +160,17 @@ public class Model3FactoryImpl extends EFactoryImpl implements Model3Factory * * @generated */ + public PolygonWithDuplicates createPolygonWithDuplicates() + { + PolygonWithDuplicatesImpl polygonWithDuplicates = new PolygonWithDuplicatesImpl(); + return polygonWithDuplicates; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ public Point createPointFromString(EDataType eDataType, String initialValue) { return (Point)super.createFromString(eDataType, initialValue); diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java index 2dfff7e7f9..e448bbc6e6 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/Model3PackageImpl.java @@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.tests.model3.Class1; import org.eclipse.emf.cdo.tests.model3.MetaRef; import org.eclipse.emf.cdo.tests.model3.Point; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; @@ -60,6 +61,13 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package * * @generated */ + private EClass polygonWithDuplicatesEClass = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ private EDataType pointEDataType = null; /** @@ -202,6 +210,26 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package * * @generated */ + public EClass getPolygonWithDuplicates() + { + return polygonWithDuplicatesEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getPolygonWithDuplicates_Points() + { + return (EAttribute)polygonWithDuplicatesEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ public EDataType getPoint() { return pointEDataType; @@ -248,6 +276,9 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package polygonEClass = createEClass(POLYGON); createEAttribute(polygonEClass, POLYGON__POINTS); + polygonWithDuplicatesEClass = createEClass(POLYGON_WITH_DUPLICATES); + createEAttribute(polygonWithDuplicatesEClass, POLYGON_WITH_DUPLICATES__POINTS); + // Create data types pointEDataType = createEDataType(POINT); } @@ -307,6 +338,11 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package initEAttribute(getPolygon_Points(), getPoint(), "points", null, 1, -1, Polygon.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(polygonWithDuplicatesEClass, PolygonWithDuplicates.class, "PolygonWithDuplicates", !IS_ABSTRACT, + !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPolygonWithDuplicates_Points(), getPoint(), "points", null, 1, -1, PolygonWithDuplicates.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + // Initialize data types initEDataType(pointEDataType, Point.class, "Point", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonWithDuplicatesImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonWithDuplicatesImpl.java new file mode 100644 index 0000000000..38dfd4acb9 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/impl/PolygonWithDuplicatesImpl.java @@ -0,0 +1,171 @@ +/** + * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.tests.legacy.model3.impl; + +import org.eclipse.emf.cdo.tests.legacy.model3.Model3Package; +import org.eclipse.emf.cdo.tests.model3.Point; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeEList; + +import java.util.Collection; + +/** + * <!-- begin-user-doc --> An implementation of the model object '<em><b>Polygon With Duplicates</b></em>'. <!-- + * end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.legacy.model3.impl.PolygonWithDuplicatesImpl#getPoints <em>Points</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class PolygonWithDuplicatesImpl extends EObjectImpl implements PolygonWithDuplicates +{ + /** + * The cached value of the '{@link #getPoints() <em>Points</em>}' attribute list. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see #getPoints() + * @generated + * @ordered + */ + protected EList<Point> points; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected PolygonWithDuplicatesImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return Model3Package.Literals.POLYGON_WITH_DUPLICATES; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EList<Point> getPoints() + { + if (points == null) + { + points = new EDataTypeEList<Point>(Point.class, this, Model3Package.POLYGON_WITH_DUPLICATES__POINTS); + } + return points; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case Model3Package.POLYGON_WITH_DUPLICATES__POINTS: + return getPoints(); + } + 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 Model3Package.POLYGON_WITH_DUPLICATES__POINTS: + getPoints().clear(); + getPoints().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 Model3Package.POLYGON_WITH_DUPLICATES__POINTS: + getPoints().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case Model3Package.POLYGON_WITH_DUPLICATES__POINTS: + return points != null && !points.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(" (points: "); + result.append(points); + result.append(')'); + return result.toString(); + } + +} // PolygonWithDuplicatesImpl diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3AdapterFactory.java index ce22ea4669..f70c777127 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3AdapterFactory.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3AdapterFactory.java @@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.tests.legacy.model3.Model3Package; import org.eclipse.emf.cdo.tests.model3.Class1; import org.eclipse.emf.cdo.tests.model3.MetaRef; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; @@ -97,6 +98,12 @@ public class Model3AdapterFactory extends AdapterFactoryImpl } @Override + public Adapter casePolygonWithDuplicates(PolygonWithDuplicates object) + { + return createPolygonWithDuplicatesAdapter(); + } + + @Override public Adapter defaultCase(EObject object) { return createEObjectAdapter(); @@ -160,6 +167,21 @@ public class Model3AdapterFactory extends AdapterFactoryImpl } /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.legacy.model3.PolygonWithDuplicates + * <em>Polygon With Duplicates</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can + * easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- + * end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.tests.legacy.model3.PolygonWithDuplicates + * @generated + */ + public Adapter createPolygonWithDuplicatesAdapter() + { + return null; + } + + /** * Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. <!-- * end-user-doc --> * diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java index 0541736405..1fbb32c0af 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/legacy/model3/util/Model3Switch.java @@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.tests.legacy.model3.Model3Package; import org.eclipse.emf.cdo.tests.model3.Class1; import org.eclipse.emf.cdo.tests.model3.MetaRef; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; @@ -124,6 +125,16 @@ public class Model3Switch<T> } return result; } + case Model3Package.POLYGON_WITH_DUPLICATES: + { + PolygonWithDuplicates polygonWithDuplicates = (PolygonWithDuplicates)theEObject; + T result = casePolygonWithDuplicates(polygonWithDuplicates); + if (result == null) + { + result = defaultCase(theEObject); + } + return result; + } default: return defaultCase(theEObject); } @@ -175,6 +186,22 @@ public class Model3Switch<T> } /** + * Returns the result of interpreting the object as an instance of '<em>Polygon With Duplicates</em>'. <!-- + * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- + * end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Polygon With Duplicates</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePolygonWithDuplicates(PolygonWithDuplicates object) + { + return null; + } + + /** * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This * implementation returns null; returning a non-null result will terminate the switch, but this is the last case * anyway. <!-- end-user-doc --> diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Factory.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Factory.java index 2af3469c75..b81a2b36fd 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Factory.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Factory.java @@ -53,6 +53,14 @@ public interface Model3Factory extends EFactory Polygon createPolygon(); /** + * Returns a new object of class '<em>Polygon With Duplicates</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return a new object of class '<em>Polygon With Duplicates</em>'. + * @generated + */ + PolygonWithDuplicates createPolygonWithDuplicates(); + + /** * Returns the package supported by this factory. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return the package supported by this factory. diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java index 923caec79f..a376280996 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java @@ -139,13 +139,40 @@ public interface Model3Package extends EPackage int POLYGON_FEATURE_COUNT = 1; /** + * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model3.impl.PolygonWithDuplicatesImpl + * <em>Polygon With Duplicates</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.emf.cdo.tests.model3.impl.PolygonWithDuplicatesImpl + * @see org.eclipse.emf.cdo.tests.model3.impl.Model3PackageImpl#getPolygonWithDuplicates() + * @generated + */ + int POLYGON_WITH_DUPLICATES = 3; + + /** + * The feature id for the '<em><b>Points</b></em>' attribute list. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int POLYGON_WITH_DUPLICATES__POINTS = 0; + + /** + * The number of structural features of the '<em>Polygon With Duplicates</em>' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int POLYGON_WITH_DUPLICATES_FEATURE_COUNT = 1; + + /** * The meta object id for the '<em>Point</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see org.eclipse.emf.cdo.tests.model3.Point * @see org.eclipse.emf.cdo.tests.model3.impl.Model3PackageImpl#getPoint() * @generated */ - int POINT = 3; + int POINT = 4; /** * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model3.Class1 <em>Class1</em>}'. <!-- @@ -211,6 +238,28 @@ public interface Model3Package extends EPackage EAttribute getPolygon_Points(); /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates + * <em>Polygon With Duplicates</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for class '<em>Polygon With Duplicates</em>'. + * @see org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates + * @generated + */ + EClass getPolygonWithDuplicates(); + + /** + * Returns the meta object for the attribute list ' + * {@link org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates#getPoints <em>Points</em>}'. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the attribute list '<em>Points</em>'. + * @see org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates#getPoints() + * @see #getPolygonWithDuplicates() + * @generated + */ + EAttribute getPolygonWithDuplicates_Points(); + + /** * Returns the meta object for data type '{@link org.eclipse.emf.cdo.tests.model3.Point <em>Point</em>}'. <!-- * begin-user-doc --> <!-- end-user-doc --> * @@ -298,6 +347,24 @@ public interface Model3Package extends EPackage EAttribute POLYGON__POINTS = eINSTANCE.getPolygon_Points(); /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model3.impl.PolygonWithDuplicatesImpl + * <em>Polygon With Duplicates</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.emf.cdo.tests.model3.impl.PolygonWithDuplicatesImpl + * @see org.eclipse.emf.cdo.tests.model3.impl.Model3PackageImpl#getPolygonWithDuplicates() + * @generated + */ + EClass POLYGON_WITH_DUPLICATES = eINSTANCE.getPolygonWithDuplicates(); + + /** + * The meta object literal for the '<em><b>Points</b></em>' attribute list feature. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + EAttribute POLYGON_WITH_DUPLICATES__POINTS = eINSTANCE.getPolygonWithDuplicates_Points(); + + /** * The meta object literal for the '<em>Point</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see org.eclipse.emf.cdo.tests.model3.Point diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Point.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Point.java index f48e91317c..7a9a9c459e 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Point.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Point.java @@ -36,6 +36,29 @@ public final class Point } @Override + public int hashCode() + { + return x ^ y; + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + { + return true; + } + + if (obj instanceof Point) + { + Point that = (Point)obj; + return x == that.getX() && y == that.getY(); + } + + return false; + } + + @Override public String toString() { return Integer.toString(x) + "," + Integer.toString(y); diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/PolygonWithDuplicates.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/PolygonWithDuplicates.java new file mode 100644 index 0000000000..e21ed0b263 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/PolygonWithDuplicates.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.tests.model3; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> A representation of the model object '<em><b>Polygon With Duplicates</b></em>'. <!-- + * end-user-doc --> + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates#getPoints <em>Points</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.emf.cdo.tests.model3.Model3Package#getPolygonWithDuplicates() + * @model + * @generated + */ +public interface PolygonWithDuplicates extends EObject +{ + /** + * Returns the value of the '<em><b>Points</b></em>' attribute list. The list contents are of type + * {@link org.eclipse.emf.cdo.tests.model3.Point}. <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Points</em>' attribute list isn't clear, there really should be more of a description + * here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Points</em>' attribute list. + * @see org.eclipse.emf.cdo.tests.model3.Model3Package#getPolygonWithDuplicates_Points() + * @model unique="false" dataType="org.eclipse.emf.cdo.tests.model3.Point" required="true" + * @generated + */ + EList<Point> getPoints(); + +} // PolygonWithDuplicates diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3FactoryImpl.java index 30ced969cf..fe3f1fc962 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3FactoryImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3FactoryImpl.java @@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.tests.model3.Model3Factory; import org.eclipse.emf.cdo.tests.model3.Model3Package; import org.eclipse.emf.cdo.tests.model3.Point; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; @@ -80,6 +81,8 @@ public class Model3FactoryImpl extends EFactoryImpl implements Model3Factory return createMetaRef(); case Model3Package.POLYGON: return createPolygon(); + case Model3Package.POLYGON_WITH_DUPLICATES: + return createPolygonWithDuplicates(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -155,6 +158,17 @@ public class Model3FactoryImpl extends EFactoryImpl implements Model3Factory /** * <!-- begin-user-doc --> <!-- end-user-doc --> * + * @generated + */ + public PolygonWithDuplicates createPolygonWithDuplicates() + { + PolygonWithDuplicatesImpl polygonWithDuplicates = new PolygonWithDuplicatesImpl(); + return polygonWithDuplicates; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * * @generated NOT */ public Point createPointFromString(EDataType eDataType, String initialValue) diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java index 8286fb94ed..00cb7cba32 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java @@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.tests.model3.Model3Factory; import org.eclipse.emf.cdo.tests.model3.Model3Package; import org.eclipse.emf.cdo.tests.model3.Point; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; import org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage; import org.eclipse.emf.cdo.tests.model3.subpackage.impl.SubpackagePackageImpl; @@ -60,6 +61,13 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package * * @generated */ + private EClass polygonWithDuplicatesEClass = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ private EDataType pointEDataType = null; /** @@ -202,6 +210,26 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package * * @generated */ + public EClass getPolygonWithDuplicates() + { + return polygonWithDuplicatesEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getPolygonWithDuplicates_Points() + { + return (EAttribute)polygonWithDuplicatesEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ public EDataType getPoint() { return pointEDataType; @@ -248,6 +276,9 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package polygonEClass = createEClass(POLYGON); createEAttribute(polygonEClass, POLYGON__POINTS); + polygonWithDuplicatesEClass = createEClass(POLYGON_WITH_DUPLICATES); + createEAttribute(polygonWithDuplicatesEClass, POLYGON_WITH_DUPLICATES__POINTS); + // Create data types pointEDataType = createEDataType(POINT); } @@ -307,6 +338,11 @@ public class Model3PackageImpl extends EPackageImpl implements Model3Package initEAttribute(getPolygon_Points(), getPoint(), "points", null, 1, -1, Polygon.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(polygonWithDuplicatesEClass, PolygonWithDuplicates.class, "PolygonWithDuplicates", !IS_ABSTRACT, + !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPolygonWithDuplicates_Points(), getPoint(), "points", null, 1, -1, PolygonWithDuplicates.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + // Initialize data types initEDataType(pointEDataType, Point.class, "Point", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/PolygonWithDuplicatesImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/PolygonWithDuplicatesImpl.java new file mode 100644 index 0000000000..12c908b90b --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/PolygonWithDuplicatesImpl.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.tests.model3.impl; + +import org.eclipse.emf.cdo.tests.model3.Model3Package; +import org.eclipse.emf.cdo.tests.model3.Point; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; + +import org.eclipse.emf.internal.cdo.CDOObjectImpl; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; + +/** + * <!-- begin-user-doc --> An implementation of the model object '<em><b>Polygon With Duplicates</b></em>'. <!-- + * end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.model3.impl.PolygonWithDuplicatesImpl#getPoints <em>Points</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class PolygonWithDuplicatesImpl extends CDOObjectImpl implements PolygonWithDuplicates +{ + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected PolygonWithDuplicatesImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() + { + return Model3Package.Literals.POLYGON_WITH_DUPLICATES; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected int eStaticFeatureCount() + { + return 0; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + public EList<Point> getPoints() + { + return (EList<Point>)eGet(Model3Package.Literals.POLYGON_WITH_DUPLICATES__POINTS, true); + } + +} // PolygonWithDuplicatesImpl diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3AdapterFactory.java index ca36d5ccc6..a3f33ac7d7 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3AdapterFactory.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3AdapterFactory.java @@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.tests.model3.Class1; import org.eclipse.emf.cdo.tests.model3.MetaRef; import org.eclipse.emf.cdo.tests.model3.Model3Package; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; @@ -97,6 +98,12 @@ public class Model3AdapterFactory extends AdapterFactoryImpl } @Override + public Adapter casePolygonWithDuplicates(PolygonWithDuplicates object) + { + return createPolygonWithDuplicatesAdapter(); + } + + @Override public Adapter defaultCase(EObject object) { return createEObjectAdapter(); @@ -160,6 +167,21 @@ public class Model3AdapterFactory extends AdapterFactoryImpl } /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates + * <em>Polygon With Duplicates</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can + * easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- + * end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates + * @generated + */ + public Adapter createPolygonWithDuplicatesAdapter() + { + return null; + } + + /** * Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. <!-- * end-user-doc --> * diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java index 7ae93cbad6..6a72932501 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java +++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java @@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.tests.model3.Class1; import org.eclipse.emf.cdo.tests.model3.MetaRef; import org.eclipse.emf.cdo.tests.model3.Model3Package; import org.eclipse.emf.cdo.tests.model3.Polygon; +import org.eclipse.emf.cdo.tests.model3.PolygonWithDuplicates; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; @@ -124,6 +125,16 @@ public class Model3Switch<T> } return result; } + case Model3Package.POLYGON_WITH_DUPLICATES: + { + PolygonWithDuplicates polygonWithDuplicates = (PolygonWithDuplicates)theEObject; + T result = casePolygonWithDuplicates(polygonWithDuplicates); + if (result == null) + { + result = defaultCase(theEObject); + } + return result; + } default: return defaultCase(theEObject); } @@ -175,6 +186,22 @@ public class Model3Switch<T> } /** + * Returns the result of interpreting the object as an instance of '<em>Polygon With Duplicates</em>'. <!-- + * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- + * end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Polygon With Duplicates</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePolygonWithDuplicates(PolygonWithDuplicates object) + { + return null; + } + + /** * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This * implementation returns null; returning a non-null result will terminate the switch, but this is the last case * anyway. <!-- end-user-doc --> |