diff options
Diffstat (limited to 'tests/org.eclipse.qvtd.cs2as.compiler.tests')
12 files changed, 1133 insertions, 85 deletions
diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/models/example2/EnvExample2.genmodel b/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/models/example2/EnvExample2.genmodel index b8229c623..c18e9b894 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/models/example2/EnvExample2.genmodel +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/models/example2/EnvExample2.genmodel @@ -17,7 +17,7 @@ <genPackages prefix="Environment" basePackage="example2.classes" disposableProviderFactory="true" ecorePackage="EnvExample2.ecore#/"> <genClasses ecoreClass="EnvExample2.ecore#//LookupEnvironment"> - <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference EnvExample2.ecore#//LookupEnvironment/namedElements"/> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference EnvExample2.ecore#//LookupEnvironment/entries"/> <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference EnvExample2.ecore#//LookupEnvironment/parentEnv"/> <genOperations ecoreOperation="EnvExample2.ecore#//LookupEnvironment/addElements"> <genParameters ecoreParameter="EnvExample2.ecore#//LookupEnvironment/addElements/elements"/> @@ -26,11 +26,23 @@ <genOperations ecoreOperation="EnvExample2.ecore#//LookupEnvironment/addElement"> <genParameters ecoreParameter="EnvExample2.ecore#//LookupEnvironment/addElement/element"/> </genOperations> + <genOperations ecoreOperation="EnvExample2.ecore#//LookupEnvironment/addElementWithName"> + <genParameters ecoreParameter="EnvExample2.ecore#//LookupEnvironment/addElementWithName/entryName"/> + <genParameters ecoreParameter="EnvExample2.ecore#//LookupEnvironment/addElementWithName/element"/> + </genOperations> + <genOperations ecoreOperation="EnvExample2.ecore#//LookupEnvironment/getNamedElements"> + <genParameters ecoreParameter="EnvExample2.ecore#//LookupEnvironment/getNamedElements/entryName"/> + </genOperations> </genClasses> <genClasses image="false" ecoreClass="EnvExample2.ecore#//Env4CG"> <genOperations ecoreOperation="EnvExample2.ecore#//Env4CG/hasFinalResult"/> <genOperations ecoreOperation="EnvExample2.ecore#//Env4CG/getExecutor"/> </genClasses> + <genClasses ecoreClass="EnvExample2.ecore#//EnvEntry"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute EnvExample2.ecore#//EnvEntry/name"/> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference EnvExample2.ecore#//EnvEntry/namedElements"/> + <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference EnvExample2.ecore#//EnvEntry/env"/> + </genClasses> <genClasses image="false" ecoreClass="EnvExample2.ecore#//Executor"/> </genPackages> </genmodel:GenModel> diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvEntry.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvEntry.java new file mode 100644 index 000000000..38efee684 --- /dev/null +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvEntry.java @@ -0,0 +1,102 @@ +/** + */ +package example2.classes.lookup; + +import example2.classes.NamedElement; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Env Entry</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * </p> + * <ul> + * <li>{@link example2.classes.lookup.EnvEntry#getName <em>Name</em>}</li> + * <li>{@link example2.classes.lookup.EnvEntry#getNamedElements <em>Named Elements</em>}</li> + * <li>{@link example2.classes.lookup.EnvEntry#getEnv <em>Env</em>}</li> + * </ul> + * + * @see example2.classes.lookup.EnvironmentPackage#getEnvEntry() + * @model + * @generated + */ +public interface EnvEntry extends EObject { + /** + * Returns the value of the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Name</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Name</em>' attribute. + * @see #setName(String) + * @see example2.classes.lookup.EnvironmentPackage#getEnvEntry_Name() + * @model annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://cs2as/tests/example2/env/1.0!EnvEntry!name'" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link example2.classes.lookup.EnvEntry#getName <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Name</em>' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the '<em><b>Named Elements</b></em>' reference list. + * The list contents are of type {@link example2.classes.NamedElement}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Named Elements</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Named Elements</em>' reference list. + * @see example2.classes.lookup.EnvironmentPackage#getEnvEntry_NamedElements() + * @model required="true" + * annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://cs2as/tests/example2/env/1.0!EnvEntry!namedElements'" + * @generated + */ + EList<NamedElement> getNamedElements(); + + /** + * Returns the value of the '<em><b>Env</b></em>' container reference. + * It is bidirectional and its opposite is '{@link example2.classes.lookup.LookupEnvironment#getEntries <em>Entries</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Env</em>' container reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Env</em>' container reference. + * @see #setEnv(LookupEnvironment) + * @see example2.classes.lookup.EnvironmentPackage#getEnvEntry_Env() + * @see example2.classes.lookup.LookupEnvironment#getEntries + * @model opposite="entries" transient="false" + * annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://cs2as/tests/example2/env/1.0!EnvEntry!env'" + * @generated + */ + LookupEnvironment getEnv(); + + /** + * Sets the value of the '{@link example2.classes.lookup.EnvEntry#getEnv <em>Env</em>}' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Env</em>' container reference. + * @see #getEnv() + * @generated + */ + void setEnv(LookupEnvironment value); + +} // EnvEntry diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentFactory.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentFactory.java index 8ce1c6f1f..cf992ec1d 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentFactory.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentFactory.java @@ -31,6 +31,15 @@ public interface EnvironmentFactory extends EFactory { LookupEnvironment createLookupEnvironment(); /** + * Returns a new object of class '<em>Env Entry</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Env Entry</em>'. + * @generated + */ + EnvEntry createEnvEntry(); + + /** * Returns the package supported by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentPackage.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentPackage.java index 9095c69f4..5c1d39e2e 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentPackage.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentPackage.java @@ -2,6 +2,7 @@ */ package example2.classes.lookup; +import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EOperation; import org.eclipse.emf.ecore.EPackage; @@ -114,13 +115,13 @@ public interface EnvironmentPackage extends EPackage { int LOOKUP_ENVIRONMENT = 0; /** - * The feature id for the '<em><b>Named Elements</b></em>' reference list. + * The feature id for the '<em><b>Entries</b></em>' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int LOOKUP_ENVIRONMENT__NAMED_ELEMENTS = ENV4_CG_FEATURE_COUNT + 0; + int LOOKUP_ENVIRONMENT__ENTRIES = ENV4_CG_FEATURE_COUNT + 0; /** * The feature id for the '<em><b>Parent Env</b></em>' reference. @@ -177,13 +178,86 @@ public interface EnvironmentPackage extends EPackage { int LOOKUP_ENVIRONMENT___ADD_ELEMENT__NAMEDELEMENT = ENV4_CG_OPERATION_COUNT + 1; /** + * The operation id for the '<em>Add Element With Name</em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LOOKUP_ENVIRONMENT___ADD_ELEMENT_WITH_NAME__STRING_NAMEDELEMENT = ENV4_CG_OPERATION_COUNT + 2; + + /** + * The operation id for the '<em>Get Named Elements</em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int LOOKUP_ENVIRONMENT___GET_NAMED_ELEMENTS__STRING = ENV4_CG_OPERATION_COUNT + 3; + + /** * The number of operations of the '<em>Lookup Environment</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int LOOKUP_ENVIRONMENT_OPERATION_COUNT = ENV4_CG_OPERATION_COUNT + 2; + int LOOKUP_ENVIRONMENT_OPERATION_COUNT = ENV4_CG_OPERATION_COUNT + 4; + + /** + * The meta object id for the '{@link example2.classes.lookup.impl.EnvEntryImpl <em>Env Entry</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see example2.classes.lookup.impl.EnvEntryImpl + * @see example2.classes.lookup.impl.EnvironmentPackageImpl#getEnvEntry() + * @generated + */ + int ENV_ENTRY = 2; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ENV_ENTRY__NAME = 0; + + /** + * The feature id for the '<em><b>Named Elements</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ENV_ENTRY__NAMED_ELEMENTS = 1; + + /** + * The feature id for the '<em><b>Env</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ENV_ENTRY__ENV = 2; + + /** + * The number of structural features of the '<em>Env Entry</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ENV_ENTRY_FEATURE_COUNT = 3; + + /** + * The number of operations of the '<em>Env Entry</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int ENV_ENTRY_OPERATION_COUNT = 0; /** * The meta object id for the '{@link org.eclipse.ocl.pivot.evaluation.Executor <em>Executor</em>}' class. @@ -193,7 +267,7 @@ public interface EnvironmentPackage extends EPackage { * @see example2.classes.lookup.impl.EnvironmentPackageImpl#getExecutor() * @generated */ - int EXECUTOR = 2; + int EXECUTOR = 3; /** * The number of structural features of the '<em>Executor</em>' class. @@ -225,15 +299,15 @@ public interface EnvironmentPackage extends EPackage { EClass getLookupEnvironment(); /** - * Returns the meta object for the reference list '{@link example2.classes.lookup.LookupEnvironment#getNamedElements <em>Named Elements</em>}'. + * Returns the meta object for the containment reference list '{@link example2.classes.lookup.LookupEnvironment#getEntries <em>Entries</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Named Elements</em>'. - * @see example2.classes.lookup.LookupEnvironment#getNamedElements() + * @return the meta object for the containment reference list '<em>Entries</em>'. + * @see example2.classes.lookup.LookupEnvironment#getEntries() * @see #getLookupEnvironment() * @generated */ - EReference getLookupEnvironment_NamedElements(); + EReference getLookupEnvironment_Entries(); /** * Returns the meta object for the reference '{@link example2.classes.lookup.LookupEnvironment#getParentEnv <em>Parent Env</em>}'. @@ -267,6 +341,26 @@ public interface EnvironmentPackage extends EPackage { EOperation getLookupEnvironment__AddElement__NamedElement(); /** + * Returns the meta object for the '{@link example2.classes.lookup.LookupEnvironment#addElementWithName(java.lang.String, example2.classes.NamedElement) <em>Add Element With Name</em>}' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the '<em>Add Element With Name</em>' operation. + * @see example2.classes.lookup.LookupEnvironment#addElementWithName(java.lang.String, example2.classes.NamedElement) + * @generated + */ + EOperation getLookupEnvironment__AddElementWithName__String_NamedElement(); + + /** + * Returns the meta object for the '{@link example2.classes.lookup.LookupEnvironment#getNamedElements(java.lang.String) <em>Get Named Elements</em>}' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the '<em>Get Named Elements</em>' operation. + * @see example2.classes.lookup.LookupEnvironment#getNamedElements(java.lang.String) + * @generated + */ + EOperation getLookupEnvironment__GetNamedElements__String(); + + /** * Returns the meta object for class '{@link example2.classes.lookup.Env4CG <em>Env4 CG</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -297,6 +391,49 @@ public interface EnvironmentPackage extends EPackage { EOperation getEnv4CG__GetExecutor(); /** + * Returns the meta object for class '{@link example2.classes.lookup.EnvEntry <em>Env Entry</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Env Entry</em>'. + * @see example2.classes.lookup.EnvEntry + * @generated + */ + EClass getEnvEntry(); + + /** + * Returns the meta object for the attribute '{@link example2.classes.lookup.EnvEntry#getName <em>Name</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Name</em>'. + * @see example2.classes.lookup.EnvEntry#getName() + * @see #getEnvEntry() + * @generated + */ + EAttribute getEnvEntry_Name(); + + /** + * Returns the meta object for the reference list '{@link example2.classes.lookup.EnvEntry#getNamedElements <em>Named Elements</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Named Elements</em>'. + * @see example2.classes.lookup.EnvEntry#getNamedElements() + * @see #getEnvEntry() + * @generated + */ + EReference getEnvEntry_NamedElements(); + + /** + * Returns the meta object for the container reference '{@link example2.classes.lookup.EnvEntry#getEnv <em>Env</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the container reference '<em>Env</em>'. + * @see example2.classes.lookup.EnvEntry#getEnv() + * @see #getEnvEntry() + * @generated + */ + EReference getEnvEntry_Env(); + + /** * Returns the meta object for class '{@link org.eclipse.ocl.pivot.evaluation.Executor <em>Executor</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -341,12 +478,12 @@ public interface EnvironmentPackage extends EPackage { EClass LOOKUP_ENVIRONMENT = eINSTANCE.getLookupEnvironment(); /** - * The meta object literal for the '<em><b>Named Elements</b></em>' reference list feature. + * The meta object literal for the '<em><b>Entries</b></em>' containment reference list feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - EReference LOOKUP_ENVIRONMENT__NAMED_ELEMENTS = eINSTANCE.getLookupEnvironment_NamedElements(); + EReference LOOKUP_ENVIRONMENT__ENTRIES = eINSTANCE.getLookupEnvironment_Entries(); /** * The meta object literal for the '<em><b>Parent Env</b></em>' reference feature. @@ -373,6 +510,22 @@ public interface EnvironmentPackage extends EPackage { EOperation LOOKUP_ENVIRONMENT___ADD_ELEMENT__NAMEDELEMENT = eINSTANCE.getLookupEnvironment__AddElement__NamedElement(); /** + * The meta object literal for the '<em><b>Add Element With Name</b></em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EOperation LOOKUP_ENVIRONMENT___ADD_ELEMENT_WITH_NAME__STRING_NAMEDELEMENT = eINSTANCE.getLookupEnvironment__AddElementWithName__String_NamedElement(); + + /** + * The meta object literal for the '<em><b>Get Named Elements</b></em>' operation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EOperation LOOKUP_ENVIRONMENT___GET_NAMED_ELEMENTS__STRING = eINSTANCE.getLookupEnvironment__GetNamedElements__String(); + + /** * The meta object literal for the '{@link example2.classes.lookup.Env4CG <em>Env4 CG</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -399,6 +552,40 @@ public interface EnvironmentPackage extends EPackage { EOperation ENV4_CG___GET_EXECUTOR = eINSTANCE.getEnv4CG__GetExecutor(); /** + * The meta object literal for the '{@link example2.classes.lookup.impl.EnvEntryImpl <em>Env Entry</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see example2.classes.lookup.impl.EnvEntryImpl + * @see example2.classes.lookup.impl.EnvironmentPackageImpl#getEnvEntry() + * @generated + */ + EClass ENV_ENTRY = eINSTANCE.getEnvEntry(); + + /** + * The meta object literal for the '<em><b>Name</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute ENV_ENTRY__NAME = eINSTANCE.getEnvEntry_Name(); + + /** + * The meta object literal for the '<em><b>Named Elements</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ENV_ENTRY__NAMED_ELEMENTS = eINSTANCE.getEnvEntry_NamedElements(); + + /** + * The meta object literal for the '<em><b>Env</b></em>' container reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference ENV_ENTRY__ENV = eINSTANCE.getEnvEntry_Env(); + + /** * The meta object literal for the '{@link org.eclipse.ocl.pivot.evaluation.Executor <em>Executor</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentTables.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentTables.java index 83d27fc29..751ef83c3 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentTables.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/EnvironmentTables.java @@ -58,17 +58,21 @@ public class EnvironmentTables /** * Constants used by auto-generated code. */ - public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull CollectionTypeId COL_PRIMid_OclAny = org.eclipse.ocl.pivot.ids.TypeId.COLLECTION.getSpecializedId(org.eclipse.ocl.pivot.ids.TypeId.OCL_ANY); public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull CollectionTypeId COL_TMPLid_ = org.eclipse.ocl.pivot.ids.TypeId.COLLECTION.getSpecializedId(org.eclipse.ocl.pivot.ids.IdManager.getTemplateParameterId(0)); public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull NsURIPackageId PACKid_http_c_s_s_cs2as_s_tests_s_example2_s_classes_s_1_0 = org.eclipse.ocl.pivot.ids.IdManager.getNsURIPackageId("http://cs2as/tests/example2/classes/1.0", null, example2.classes.ClassesPackage.eINSTANCE); public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull NsURIPackageId PACKid_http_c_s_s_cs2as_s_tests_s_example2_s_env_s_1_0 = org.eclipse.ocl.pivot.ids.IdManager.getNsURIPackageId("http://cs2as/tests/example2/env/1.0", null, example2.classes.lookup.EnvironmentPackage.eINSTANCE); + public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull ClassId CLSSid_EnvEntry = example2.classes.lookup.EnvironmentTables.PACKid_http_c_s_s_cs2as_s_tests_s_example2_s_env_s_1_0.getClassId("EnvEntry", 0); public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull ClassId CLSSid_Executor = example2.classes.lookup.EnvironmentTables.PACKid_http_c_s_s_cs2as_s_tests_s_example2_s_env_s_1_0.getClassId("Executor", 0); public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull ClassId CLSSid_LookupEnvironment = example2.classes.lookup.EnvironmentTables.PACKid_http_c_s_s_cs2as_s_tests_s_example2_s_env_s_1_0.getClassId("LookupEnvironment", 0); public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull ClassId CLSSid_NamedElement = example2.classes.lookup.EnvironmentTables.PACKid_http_c_s_s_cs2as_s_tests_s_example2_s_classes_s_1_0.getClassId("NamedElement", 0); public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull CollectionTypeId BAG_CLSSid_LookupEnvironment = org.eclipse.ocl.pivot.ids.TypeId.BAG.getSpecializedId(example2.classes.lookup.EnvironmentTables.CLSSid_LookupEnvironment); + public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull CollectionTypeId COL_CLSSid_NamedElement = org.eclipse.ocl.pivot.ids.TypeId.COLLECTION.getSpecializedId(example2.classes.lookup.EnvironmentTables.CLSSid_NamedElement); + public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull CollectionTypeId ORD_CLSSid_EnvEntry = org.eclipse.ocl.pivot.ids.TypeId.ORDERED_SET.getSpecializedId(example2.classes.lookup.EnvironmentTables.CLSSid_EnvEntry); public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull CollectionTypeId ORD_CLSSid_NamedElement = org.eclipse.ocl.pivot.ids.TypeId.ORDERED_SET.getSpecializedId(example2.classes.lookup.EnvironmentTables.CLSSid_NamedElement); - public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull PropertyId PROPid_namedElements = example2.classes.lookup.EnvironmentTables.CLSSid_LookupEnvironment.getPropertyId("namedElements"); - public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull PropertyId PROPid_parentEnv = example2.classes.lookup.EnvironmentTables.CLSSid_LookupEnvironment.getPropertyId("parentEnv"); + public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull PropertyId PROPid_entries = example2.classes.lookup.EnvironmentTables.CLSSid_LookupEnvironment.getPropertyId("entries"); + public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull PropertyId PROPid_name = example2.classes.lookup.EnvironmentTables.CLSSid_EnvEntry.getPropertyId("name"); + public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull PropertyId PROPid_namedElements = example2.classes.lookup.EnvironmentTables.CLSSid_EnvEntry.getPropertyId("namedElements"); + public static final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull CollectionTypeId SEQ_CLSSid_NamedElement = org.eclipse.ocl.pivot.ids.TypeId.SEQUENCE.getSpecializedId(example2.classes.lookup.EnvironmentTables.CLSSid_NamedElement); /** * The type parameters for templated types and operations. @@ -100,11 +104,13 @@ public class EnvironmentTables } public static final @NonNull EcoreExecutorType _Env4CG = new EcoreExecutorType(EnvironmentPackage.Literals.ENV4_CG, PACKAGE, 0 | ExecutorType.ABSTRACT); + public static final @NonNull EcoreExecutorType _EnvEntry = new EcoreExecutorType(EnvironmentPackage.Literals.ENV_ENTRY, PACKAGE, 0); public static final @NonNull EcoreExecutorType _Executor = new EcoreExecutorType(EnvironmentPackage.Literals.EXECUTOR, PACKAGE, 0 | ExecutorType.ABSTRACT); public static final @NonNull EcoreExecutorType _LookupEnvironment = new EcoreExecutorType(EnvironmentPackage.Literals.LOOKUP_ENVIRONMENT, PACKAGE, 0); private static final @NonNull EcoreExecutorType @NonNull [] types = { _Env4CG, + _EnvEntry, _Executor, _LookupEnvironment }; @@ -136,6 +142,10 @@ public class EnvironmentTables private static final @NonNull ExecutorFragment _Env4CG__OclAny = new ExecutorFragment(Types._Env4CG, OCLstdlibTables.Types._OclAny); private static final @NonNull ExecutorFragment _Env4CG__OclElement = new ExecutorFragment(Types._Env4CG, OCLstdlibTables.Types._OclElement); + private static final @NonNull ExecutorFragment _EnvEntry__EnvEntry = new ExecutorFragment(Types._EnvEntry, EnvironmentTables.Types._EnvEntry); + private static final @NonNull ExecutorFragment _EnvEntry__OclAny = new ExecutorFragment(Types._EnvEntry, OCLstdlibTables.Types._OclAny); + private static final @NonNull ExecutorFragment _EnvEntry__OclElement = new ExecutorFragment(Types._EnvEntry, OCLstdlibTables.Types._OclElement); + private static final @NonNull ExecutorFragment _Executor__Executor = new ExecutorFragment(Types._Executor, EnvironmentTables.Types._Executor); private static final @NonNull ExecutorFragment _Executor__OclAny = new ExecutorFragment(Types._Executor, OCLstdlibTables.Types._OclAny); private static final @NonNull ExecutorFragment _Executor__OclElement = new ExecutorFragment(Types._Executor, OCLstdlibTables.Types._OclElement); @@ -166,6 +176,8 @@ public class EnvironmentTables public static final @NonNull ParameterTypes _Collection__LookupEnvironment_addElements_NE__ = TypeUtil.createParameterTypes(new ExecutorSpecializedType("Collection", EnvironmentTables.TypeParameters.__LookupEnvironment__addElements_NE)); public static final @NonNull ParameterTypes _NamedElement = TypeUtil.createParameterTypes(ClassesTables.Types._NamedElement); + public static final @NonNull ParameterTypes _String = TypeUtil.createParameterTypes(OCLstdlibTables.Types._String); + public static final @NonNull ParameterTypes _String___NamedElement = TypeUtil.createParameterTypes(OCLstdlibTables.Types._String, ClassesTables.Types._NamedElement); static { Init.initEnd(); @@ -193,8 +205,12 @@ public class EnvironmentTables public static final @NonNull ExecutorOperation _LookupEnvironment__addElement = new ExecutorOperation("addElement", Parameters._NamedElement, Types._LookupEnvironment, 0, TemplateParameters.EMPTY_LIST, null); + public static final @NonNull ExecutorOperation _LookupEnvironment__addElementWithName = new ExecutorOperation("addElementWithName", Parameters._String___NamedElement, Types._LookupEnvironment, + 1, TemplateParameters.EMPTY_LIST, null); public static final @NonNull ExecutorOperation _LookupEnvironment__addElements = new ExecutorOperation("addElements", Parameters._Collection__LookupEnvironment_addElements_NE__, Types._LookupEnvironment, - 1, TypeUtil.createTemplateParameters(TypeParameters.__LookupEnvironment__addElements_NE), null); + 2, TypeUtil.createTemplateParameters(TypeParameters.__LookupEnvironment__addElements_NE), null); + public static final @NonNull ExecutorOperation _LookupEnvironment__getNamedElements = new ExecutorOperation("getNamedElements", Parameters._String, Types._LookupEnvironment, + 3, TemplateParameters.EMPTY_LIST, null); static { Init.initEnd(); @@ -216,7 +232,11 @@ public class EnvironmentTables } - public static final @NonNull ExecutorProperty _LookupEnvironment__namedElements = new EcoreExecutorProperty(EnvironmentPackage.Literals.LOOKUP_ENVIRONMENT__NAMED_ELEMENTS, Types._LookupEnvironment, 0); + public static final @NonNull ExecutorProperty _EnvEntry__env = new EcoreExecutorProperty(EnvironmentPackage.Literals.ENV_ENTRY__ENV, Types._EnvEntry, 0); + public static final @NonNull ExecutorProperty _EnvEntry__name = new EcoreExecutorProperty(EnvironmentPackage.Literals.ENV_ENTRY__NAME, Types._EnvEntry, 1); + public static final @NonNull ExecutorProperty _EnvEntry__namedElements = new EcoreExecutorProperty(EnvironmentPackage.Literals.ENV_ENTRY__NAMED_ELEMENTS, Types._EnvEntry, 2); + + public static final @NonNull ExecutorProperty _LookupEnvironment__entries = new EcoreExecutorProperty(EnvironmentPackage.Literals.LOOKUP_ENVIRONMENT__ENTRIES, Types._LookupEnvironment, 0); public static final @NonNull ExecutorProperty _LookupEnvironment__parentEnv = new EcoreExecutorProperty(EnvironmentPackage.Literals.LOOKUP_ENVIRONMENT__PARENT_ENV, Types._LookupEnvironment, 1); public static final @NonNull ExecutorProperty _LookupEnvironment__LookupEnvironment__parentEnv = new ExecutorPropertyWithImplementation("LookupEnvironment", Types._LookupEnvironment, 2, new EcoreLibraryOppositeProperty(EnvironmentPackage.Literals.LOOKUP_ENVIRONMENT__PARENT_ENV)); static { @@ -246,6 +266,14 @@ public class EnvironmentTables }; private static final int @NonNull [] __Env4CG = { 1,1,1 }; + private static final @NonNull ExecutorFragment @NonNull [] _EnvEntry = + { + Fragments._EnvEntry__OclAny /* 0 */, + Fragments._EnvEntry__OclElement /* 1 */, + Fragments._EnvEntry__EnvEntry /* 2 */ + }; + private static final int @NonNull [] __EnvEntry = { 1,1,1 }; + private static final @NonNull ExecutorFragment @NonNull [] _Executor = { Fragments._Executor__OclAny /* 0 */, @@ -268,6 +296,7 @@ public class EnvironmentTables */ static { Types._Env4CG.initFragments(_Env4CG, __Env4CG); + Types._EnvEntry.initFragments(_EnvEntry, __EnvEntry); Types._Executor.initFragments(_Executor, __Executor); Types._LookupEnvironment.initFragments(_LookupEnvironment, __LookupEnvironment); @@ -320,6 +349,34 @@ public class EnvironmentTables OCLstdlibTables.Operations._OclElement__oclModelTypes /* oclModelTypes() */ }; + private static final @NonNull ExecutorOperation @NonNull [] _EnvEntry__EnvEntry = {}; + private static final @NonNull ExecutorOperation @NonNull [] _EnvEntry__OclAny = { + OCLstdlibTables.Operations._OclAny___lt__gt_ /* _'<>'(OclSelf[?]) */, + OCLstdlibTables.Operations._OclAny___eq_ /* _'='(OclSelf[?]) */, + OCLstdlibTables.Operations._OclAny__oclAsSet /* oclAsSet() */, + OCLstdlibTables.Operations._OclAny__oclAsType /* oclAsType(TT)(TT[?]) */, + OCLstdlibTables.Operations._OclAny__oclIsInState /* oclIsInState(OclState[?]) */, + OCLstdlibTables.Operations._OclAny__oclIsInvalid /* oclIsInvalid() */, + OCLstdlibTables.Operations._OclAny__oclIsKindOf /* oclIsKindOf(OclType[?]) */, + OCLstdlibTables.Operations._OclAny__oclIsNew /* oclIsNew() */, + OCLstdlibTables.Operations._OclAny__oclIsTypeOf /* oclIsTypeOf(OclType[?]) */, + OCLstdlibTables.Operations._OclAny__oclIsUndefined /* oclIsUndefined() */, + OCLstdlibTables.Operations._OclAny__0_oclLog /* oclLog() */, + OCLstdlibTables.Operations._OclAny__1_oclLog /* oclLog(String[?]) */, + OCLstdlibTables.Operations._OclAny__oclType /* oclType() */, + OCLstdlibTables.Operations._OclAny__oclTypes /* oclTypes() */, + OCLstdlibTables.Operations._OclAny__toString /* toString() */ + }; + private static final @NonNull ExecutorOperation @NonNull [] _EnvEntry__OclElement = { + OCLstdlibTables.Operations._OclElement__allInstances /* allInstances() */, + OCLstdlibTables.Operations._OclElement__oclAsModelType /* oclAsModelType(TT)(TT[?]) */, + OCLstdlibTables.Operations._OclElement__oclContainer /* oclContainer() */, + OCLstdlibTables.Operations._OclElement__oclContents /* oclContents() */, + OCLstdlibTables.Operations._OclElement__oclIsModelKindOf /* oclIsModelKindOf(OclType[?]) */, + OCLstdlibTables.Operations._OclElement__oclModelType /* oclModelType() */, + OCLstdlibTables.Operations._OclElement__oclModelTypes /* oclModelTypes() */ + }; + private static final @NonNull ExecutorOperation @NonNull [] _Executor__Executor = {}; private static final @NonNull ExecutorOperation @NonNull [] _Executor__OclAny = { OCLstdlibTables.Operations._OclAny___lt__gt_ /* _'<>'(OclSelf[?]) */, @@ -349,8 +406,10 @@ public class EnvironmentTables }; private static final @NonNull ExecutorOperation @NonNull [] _LookupEnvironment__LookupEnvironment = { - EnvironmentTables.Operations._LookupEnvironment__addElement /* addElement(NamedElement[?]) */, - EnvironmentTables.Operations._LookupEnvironment__addElements /* addElements(NE)(Collection(NE)) */ + EnvironmentTables.Operations._LookupEnvironment__addElement /* addElement(NamedElement[1]) */, + EnvironmentTables.Operations._LookupEnvironment__addElementWithName /* addElementWithName(String[?],NamedElement[1]) */, + EnvironmentTables.Operations._LookupEnvironment__addElements /* addElements(NE)(Collection(NE)) */, + EnvironmentTables.Operations._LookupEnvironment__getNamedElements /* getNamedElements(String[?]) */ }; private static final @NonNull ExecutorOperation @NonNull [] _LookupEnvironment__Env4CG = { EnvironmentTables.Operations._Env4CG__getExecutor /* getExecutor() */, @@ -391,6 +450,10 @@ public class EnvironmentTables Fragments._Env4CG__OclAny.initOperations(_Env4CG__OclAny); Fragments._Env4CG__OclElement.initOperations(_Env4CG__OclElement); + Fragments._EnvEntry__EnvEntry.initOperations(_EnvEntry__EnvEntry); + Fragments._EnvEntry__OclAny.initOperations(_EnvEntry__OclAny); + Fragments._EnvEntry__OclElement.initOperations(_EnvEntry__OclElement); + Fragments._Executor__Executor.initOperations(_Executor__Executor); Fragments._Executor__OclAny.initOperations(_Executor__OclAny); Fragments._Executor__OclElement.initOperations(_Executor__OclElement); @@ -420,10 +483,16 @@ public class EnvironmentTables private static final @NonNull ExecutorProperty @NonNull [] _Env4CG = {}; + private static final @NonNull ExecutorProperty @NonNull [] _EnvEntry = { + EnvironmentTables.Properties._EnvEntry__env, + EnvironmentTables.Properties._EnvEntry__name, + EnvironmentTables.Properties._EnvEntry__namedElements + }; + private static final @NonNull ExecutorProperty @NonNull [] _Executor = {}; private static final @NonNull ExecutorProperty @NonNull [] _LookupEnvironment = { - EnvironmentTables.Properties._LookupEnvironment__namedElements, + EnvironmentTables.Properties._LookupEnvironment__entries, EnvironmentTables.Properties._LookupEnvironment__parentEnv, EnvironmentTables.Properties._LookupEnvironment__LookupEnvironment__parentEnv }; @@ -433,6 +502,7 @@ public class EnvironmentTables */ static { Fragments._Env4CG__Env4CG.initProperties(_Env4CG); + Fragments._EnvEntry__EnvEntry.initProperties(_EnvEntry); Fragments._Executor__Executor.initProperties(_Executor); Fragments._LookupEnvironment__LookupEnvironment.initProperties(_LookupEnvironment); diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/LookupEnvironment.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/LookupEnvironment.java index 7c62693eb..bbfa08be1 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/LookupEnvironment.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/LookupEnvironment.java @@ -16,7 +16,7 @@ import java.util.Collection; * The following features are supported: * </p> * <ul> - * <li>{@link example2.classes.lookup.LookupEnvironment#getNamedElements <em>Named Elements</em>}</li> + * <li>{@link example2.classes.lookup.LookupEnvironment#getEntries <em>Entries</em>}</li> * <li>{@link example2.classes.lookup.LookupEnvironment#getParentEnv <em>Parent Env</em>}</li> * </ul> * @@ -26,20 +26,23 @@ import java.util.Collection; */ public interface LookupEnvironment extends Env4CG { /** - * Returns the value of the '<em><b>Named Elements</b></em>' reference list. - * The list contents are of type {@link example2.classes.NamedElement}. + * Returns the value of the '<em><b>Entries</b></em>' containment reference list. + * The list contents are of type {@link example2.classes.lookup.EnvEntry}. + * It is bidirectional and its opposite is '{@link example2.classes.lookup.EnvEntry#getEnv <em>Env</em>}'. * <!-- begin-user-doc --> * <p> - * If the meaning of the '<em>Named Elements</em>' reference list isn't clear, + * If the meaning of the '<em>Entries</em>' containment reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> - * @return the value of the '<em>Named Elements</em>' reference list. - * @see example2.classes.lookup.EnvironmentPackage#getLookupEnvironment_NamedElements() - * @model annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://cs2as/tests/example2/env/1.0!LookupEnvironment!namedElements'" + * @return the value of the '<em>Entries</em>' containment reference list. + * @see example2.classes.lookup.EnvironmentPackage#getLookupEnvironment_Entries() + * @see example2.classes.lookup.EnvEntry#getEnv + * @model opposite="env" containment="true" + * annotation="http://www.eclipse.org/emf/2002/GenModel get='throw new UnsupportedOperationException(); // FIXME Unimplemented http://cs2as/tests/example2/env/1.0!LookupEnvironment!entries'" * @generated */ - EList<NamedElement> getNamedElements(); + EList<EnvEntry> getEntries(); /** * Returns the value of the '<em><b>Parent Env</b></em>' reference. @@ -71,7 +74,7 @@ public interface LookupEnvironment extends Env4CG { * <!-- begin-user-doc --> * <!-- end-user-doc --> * @model required="true" elementsType="org.eclipse.ocl.pivot.oclstdlib.Collection<NE>" elementsRequired="true" - * annotation="http://www.eclipse.org/emf/2002/GenModel body='/**\n * \n * LookupEnvironment{\n * namedElements = namedElements->includingAll(elements), parentEnv = parentEnv\n * }\n \052/\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.evaluation.@<%org.eclipse.jdt.annotation.NonNull%> Executor executor = <%org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal%>.getExecutor(this);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.ids.@<%org.eclipse.jdt.annotation.NonNull%> IdResolver idResolver = executor.getIdResolver();\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Property CTORid_namedElements = idResolver.getProperty(<%example2.classes.lookup.EnvironmentTables%>.PROPid_namedElements);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Property CTORid_parentEnv = idResolver.getProperty(<%example2.classes.lookup.EnvironmentTables%>.PROPid_parentEnv);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Class TYP_lookup_c_c_LookupEnvironment_0 = idResolver.getClass(<%example2.classes.lookup.EnvironmentTables%>.CLSSid_LookupEnvironment, null);\nfinal /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.NonNull%> LookupEnvironment symbol_0 = (<%example2.classes.lookup.LookupEnvironment%>)TYP_lookup_c_c_LookupEnvironment_0.createInstance();\n@SuppressWarnings(\"null\")\nfinal /*@Thrown\052/ java.util.@<%org.eclipse.jdt.annotation.NonNull%> List<<%example2.classes.NamedElement%>> namedElements = this.getNamedElements();\nfinal /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue BOXED_namedElements = idResolver.createOrderedSetOfAll(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_NamedElement, namedElements);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> CollectionValue BOXED_elements = idResolver.createCollectionOfAll(<%example2.classes.lookup.EnvironmentTables%>.COL_TMPLid_, elements);\nfinal /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> CollectionValue includingAll = <%org.eclipse.ocl.pivot.library.collection.CollectionIncludingAllOperation%>.INSTANCE.evaluate(BOXED_namedElements, BOXED_elements);\nfinal <%java.util.List%><? extends <%java.lang.Object%>> UNBOXED_includingAll = includingAll.asEcoreObjects(idResolver, <%java.lang.Object%>.class);\nassert UNBOXED_includingAll != null;\nCTORid_namedElements.initValue(symbol_0, UNBOXED_includingAll);\nfinal /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.Nullable%> LookupEnvironment parentEnv = this.getParentEnv();\nCTORid_parentEnv.initValue(symbol_0, parentEnv);\nreturn symbol_0;'" + * annotation="http://www.eclipse.org/emf/2002/GenModel body='/**\n * \n * elements->iterate(x; acc : LookupEnvironment[?] = self |\n * acc.addElement(x))\n \052/\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.evaluation.@<%org.eclipse.jdt.annotation.NonNull%> Executor executor = <%org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal%>.getExecutor(this);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.ids.@<%org.eclipse.jdt.annotation.NonNull%> IdResolver idResolver = executor.getIdResolver();\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> CollectionValue BOXED_elements = idResolver.createCollectionOfAll(<%example2.classes.lookup.EnvironmentTables%>.COL_TMPLid_, elements);\n/*@NonInvalid\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.NonNull%> LookupEnvironment acc = this;\n@<%org.eclipse.jdt.annotation.Nullable%> <%java.util.Iterator%><?> ITERATOR_x = BOXED_elements.iterator();\n/*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.Nullable%> LookupEnvironment iterate;\nwhile (true) {\n if (!ITERATOR_x.hasNext()) {\n iterate = acc;\n break;\n }\n /*@NonInvalid\052/ example2.classes.@<%org.eclipse.jdt.annotation.Nullable%> NamedElement x = (<%example2.classes.NamedElement%>)ITERATOR_x.next();\n /**\n * acc.addElement(x)\n \052/\n @SuppressWarnings(\"null\")\n final /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.NonNull%> LookupEnvironment addElement = acc.addElement(x);\n //\n acc = addElement;\n}\nif (iterate == null) {\n throw new <%org.eclipse.ocl.pivot.values.InvalidValueException%>(\"Null body for \\\'lookup::LookupEnvironment::addElements(NE)(Collection(addElements.NE)) : lookup::LookupEnvironment[1]\\\'\");\n}\nreturn iterate;'" * @generated */ <NE extends NamedElement> LookupEnvironment addElements(Collection<NE> elements); @@ -79,10 +82,27 @@ public interface LookupEnvironment extends Env4CG { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @model required="true" - * annotation="http://www.eclipse.org/emf/2002/GenModel body='/**\n * \n * LookupEnvironment{\n * namedElements = namedElements->including(element), parentEnv = parentEnv\n * }\n \052/\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.evaluation.@<%org.eclipse.jdt.annotation.NonNull%> Executor executor = <%org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal%>.getExecutor(this);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.ids.@<%org.eclipse.jdt.annotation.NonNull%> IdResolver idResolver = executor.getIdResolver();\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Property CTORid_namedElements = idResolver.getProperty(<%example2.classes.lookup.EnvironmentTables%>.PROPid_namedElements);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Property CTORid_parentEnv = idResolver.getProperty(<%example2.classes.lookup.EnvironmentTables%>.PROPid_parentEnv);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Class TYP_lookup_c_c_LookupEnvironment_0 = idResolver.getClass(<%example2.classes.lookup.EnvironmentTables%>.CLSSid_LookupEnvironment, null);\nfinal /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.NonNull%> LookupEnvironment symbol_0 = (<%example2.classes.lookup.LookupEnvironment%>)TYP_lookup_c_c_LookupEnvironment_0.createInstance();\n@SuppressWarnings(\"null\")\nfinal /*@Thrown\052/ java.util.@<%org.eclipse.jdt.annotation.NonNull%> List<<%example2.classes.NamedElement%>> namedElements = this.getNamedElements();\nfinal /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue BOXED_namedElements = idResolver.createOrderedSetOfAll(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_NamedElement, namedElements);\nfinal /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue including = (<%org.eclipse.ocl.pivot.values.OrderedSetValue%>)<%org.eclipse.ocl.pivot.library.collection.CollectionIncludingOperation%>.INSTANCE.evaluate(BOXED_namedElements, element);\nfinal <%java.util.List%><<%example2.classes.NamedElement%>> UNBOXED_including = including.asEcoreObjects(idResolver, <%example2.classes.NamedElement%>.class);\nassert UNBOXED_including != null;\nCTORid_namedElements.initValue(symbol_0, UNBOXED_including);\nfinal /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.Nullable%> LookupEnvironment parentEnv = this.getParentEnv();\nCTORid_parentEnv.initValue(symbol_0, parentEnv);\nreturn symbol_0;'" + * @model required="true" elementRequired="true" + * annotation="http://www.eclipse.org/emf/2002/GenModel body='/**\n * addElementWithName(element.name, element)\n \052/\nfinal /*@Thrown\052/ java.lang.@<%org.eclipse.jdt.annotation.Nullable%> String name = element.getName();\n@SuppressWarnings(\"null\")\nfinal /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.NonNull%> LookupEnvironment addElementWithName = this.addElementWithName(name, element);\nreturn addElementWithName;'" * @generated */ LookupEnvironment addElement(NamedElement element); + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @model required="true" elementRequired="true" + * annotation="http://www.eclipse.org/emf/2002/GenModel body='/**\n * \n * let entry : OrderedSet(lookup::EnvEntry) = entries->select(name = entryName)\n * in\n * LookupEnvironment{\n * entries = if entry = null\n * then\n * entries->including(\n * EnvEntry{name = entryName, namedElements = OrderedSet{element}\n * })\n * else\n * entries->excluding(entry)\n * ->including(\n * EnvEntry{\n * name = entryName, namedElements = entry.namedElements->including(element)\n * })\n * endif\n * }\n \052/\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.evaluation.@<%org.eclipse.jdt.annotation.NonNull%> Executor executor = <%org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal%>.getExecutor(this);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.ids.@<%org.eclipse.jdt.annotation.NonNull%> IdResolver idResolver = executor.getIdResolver();\n@SuppressWarnings(\"null\")\nfinal /*@Thrown\052/ java.util.@<%org.eclipse.jdt.annotation.NonNull%> List<<%example2.classes.lookup.EnvEntry%>> entries = this.getEntries();\nfinal /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue BOXED_entries = idResolver.createOrderedSetOfAll(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_EnvEntry, entries);\n/*@Thrown\052/ <%org.eclipse.ocl.pivot.values.OrderedSetValue%>.@org.eclipse.jdt.annotation.NonNull Accumulator accumulator = <%org.eclipse.ocl.pivot.utilities.ValueUtil%>.createOrderedSetAccumulatorValue(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_EnvEntry);\n@<%org.eclipse.jdt.annotation.Nullable%> <%java.util.Iterator%><?> ITERATOR__1 = BOXED_entries.iterator();\n/*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue entry;\nwhile (true) {\n if (!ITERATOR__1.hasNext()) {\n entry = accumulator;\n break;\n }\n /*@NonInvalid\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.Nullable%> EnvEntry _1 = (<%example2.classes.lookup.EnvEntry%>)ITERATOR__1.next();\n /**\n * name = entryName\n \052/\n if (_1 == null) {\n throw new <%org.eclipse.ocl.pivot.values.InvalidValueException%>(\"Null source for \\\'\\\'http://cs2as/tests/example2/env/1.0\\\'::EnvEntry::name\\\'\");\n }\n final /*@Thrown\052/ java.lang.@<%org.eclipse.jdt.annotation.Nullable%> String name = _1.getName();\n final /*@Thrown\052/ boolean eq = (name != null) ? name.equals(entryName) : (entryName == null);\n //\n if (eq == <%org.eclipse.ocl.pivot.utilities.ValueUtil%>.TRUE_VALUE) {\n accumulator.add(_1);\n }\n}\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Property CTORid_name_0 = idResolver.getProperty(<%example2.classes.lookup.EnvironmentTables%>.PROPid_name);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Class TYP_lookup_c_c_EnvEntry_1 = idResolver.getClass(<%example2.classes.lookup.EnvironmentTables%>.CLSSid_EnvEntry, null);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Class TYP_lookup_c_c_LookupEnvironment_0 = idResolver.getClass(<%example2.classes.lookup.EnvironmentTables%>.CLSSid_LookupEnvironment, null);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Property CTORid_entries = idResolver.getProperty(<%example2.classes.lookup.EnvironmentTables%>.PROPid_entries);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.@<%org.eclipse.jdt.annotation.NonNull%> Property CTORid_namedElements_0 = idResolver.getProperty(<%example2.classes.lookup.EnvironmentTables%>.PROPid_namedElements);\nfinal /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.NonNull%> LookupEnvironment symbol_3 = (<%example2.classes.lookup.LookupEnvironment%>)TYP_lookup_c_c_LookupEnvironment_0.createInstance();\nfinal /*@Thrown\052/ boolean eq_0 = false;\n/*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue symbol_2;\nif (eq_0) {\n final /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.NonNull%> EnvEntry symbol_0 = (<%example2.classes.lookup.EnvEntry%>)TYP_lookup_c_c_EnvEntry_1.createInstance();\n CTORid_name_0.initValue(symbol_0, entryName);\n final /*@NonInvalid\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue OrderedSet = <%org.eclipse.ocl.pivot.utilities.ValueUtil%>.createOrderedSetOfEach(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_NamedElement, element);\n final <%java.util.List%><<%example2.classes.NamedElement%>> UNBOXED_OrderedSet = OrderedSet.asEcoreObjects(idResolver, <%example2.classes.NamedElement%>.class);\n assert UNBOXED_OrderedSet != null;\n CTORid_namedElements_0.initValue(symbol_0, UNBOXED_OrderedSet);\n final /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue including = (<%org.eclipse.ocl.pivot.values.OrderedSetValue%>)<%org.eclipse.ocl.pivot.library.collection.CollectionIncludingOperation%>.INSTANCE.evaluate(BOXED_entries, symbol_0);\n symbol_2 = including;\n}\nelse {\n final /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue excluding = (<%org.eclipse.ocl.pivot.values.OrderedSetValue%>)<%org.eclipse.ocl.pivot.library.collection.CollectionExcludingOperation%>.INSTANCE.evaluate(BOXED_entries, entry);\n final /*@Thrown\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.NonNull%> EnvEntry symbol_1 = (<%example2.classes.lookup.EnvEntry%>)TYP_lookup_c_c_EnvEntry_1.createInstance();\n CTORid_name_0.initValue(symbol_1, entryName);\n /*@Thrown\052/ <%org.eclipse.ocl.pivot.values.SequenceValue%>.@org.eclipse.jdt.annotation.NonNull Accumulator accumulator_0 = <%org.eclipse.ocl.pivot.utilities.ValueUtil%>.createSequenceAccumulatorValue(<%example2.classes.lookup.EnvironmentTables%>.SEQ_CLSSid_NamedElement);\n @<%org.eclipse.jdt.annotation.Nullable%> <%java.util.Iterator%><?> ITERATOR__1_0 = entry.iterator();\n /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> SequenceValue collect;\n while (true) {\n if (!ITERATOR__1_0.hasNext()) {\n collect = accumulator_0;\n break;\n }\n /*@NonInvalid\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.Nullable%> EnvEntry _1_0 = (<%example2.classes.lookup.EnvEntry%>)ITERATOR__1_0.next();\n /**\n * namedElements\n \052/\n if (_1_0 == null) {\n throw new <%org.eclipse.ocl.pivot.values.InvalidValueException%>(\"Null source for \\\'\\\'http://cs2as/tests/example2/env/1.0\\\'::EnvEntry::namedElements\\\'\");\n }\n @SuppressWarnings(\"null\")\n final /*@Thrown\052/ java.util.@<%org.eclipse.jdt.annotation.NonNull%> List<<%example2.classes.NamedElement%>> namedElements_0 = _1_0.getNamedElements();\n final /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue BOXED_namedElements_0 = idResolver.createOrderedSetOfAll(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_NamedElement, namedElements_0);\n //\n for (Object value : BOXED_namedElements_0.flatten().getElements()) {\n accumulator_0.add(value);\n }\n }\n final /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> SequenceValue including_0 = (<%org.eclipse.ocl.pivot.values.SequenceValue%>)<%org.eclipse.ocl.pivot.library.collection.CollectionIncludingOperation%>.INSTANCE.evaluate(collect, element);\n final <%java.util.List%><<%example2.classes.NamedElement%>> UNBOXED_including_0 = including_0.asEcoreObjects(idResolver, <%example2.classes.NamedElement%>.class);\n assert UNBOXED_including_0 != null;\n CTORid_namedElements_0.initValue(symbol_1, UNBOXED_including_0);\n final /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue including_1 = (<%org.eclipse.ocl.pivot.values.OrderedSetValue%>)<%org.eclipse.ocl.pivot.library.collection.CollectionIncludingOperation%>.INSTANCE.evaluate(excluding, symbol_1);\n symbol_2 = including_1;\n}\nfinal <%java.util.List%><<%example2.classes.lookup.EnvEntry%>> UNBOXED_symbol_2 = symbol_2.asEcoreObjects(idResolver, <%example2.classes.lookup.EnvEntry%>.class);\nassert UNBOXED_symbol_2 != null;\nCTORid_entries.initValue(symbol_3, UNBOXED_symbol_2);\nreturn symbol_3;'" + * @generated + */ + LookupEnvironment addElementWithName(String entryName, NamedElement element); + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @model annotation="http://www.eclipse.org/emf/2002/GenModel body='/**\n * \n * let entry : OrderedSet(lookup::EnvEntry) = entries->select(name = entryName)\n * in if entry = null then OrderedSet{} else entry.namedElements endif\n \052/\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.evaluation.@<%org.eclipse.jdt.annotation.NonNull%> Executor executor = <%org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal%>.getExecutor(this);\nfinal /*@NonInvalid\052/ org.eclipse.ocl.pivot.ids.@<%org.eclipse.jdt.annotation.NonNull%> IdResolver idResolver = executor.getIdResolver();\n@SuppressWarnings(\"null\")\nfinal /*@Thrown\052/ java.util.@<%org.eclipse.jdt.annotation.NonNull%> List<<%example2.classes.lookup.EnvEntry%>> entries = this.getEntries();\nfinal /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue BOXED_entries = idResolver.createOrderedSetOfAll(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_EnvEntry, entries);\n/*@Thrown\052/ <%org.eclipse.ocl.pivot.values.OrderedSetValue%>.@org.eclipse.jdt.annotation.NonNull Accumulator accumulator = <%org.eclipse.ocl.pivot.utilities.ValueUtil%>.createOrderedSetAccumulatorValue(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_EnvEntry);\n@<%org.eclipse.jdt.annotation.Nullable%> <%java.util.Iterator%><?> ITERATOR__1 = BOXED_entries.iterator();\n/*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue entry;\nwhile (true) {\n if (!ITERATOR__1.hasNext()) {\n entry = accumulator;\n break;\n }\n /*@NonInvalid\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.Nullable%> EnvEntry _1 = (<%example2.classes.lookup.EnvEntry%>)ITERATOR__1.next();\n /**\n * name = entryName\n \052/\n if (_1 == null) {\n throw new <%org.eclipse.ocl.pivot.values.InvalidValueException%>(\"Null source for \\\'\\\'http://cs2as/tests/example2/env/1.0\\\'::EnvEntry::name\\\'\");\n }\n final /*@Thrown\052/ java.lang.@<%org.eclipse.jdt.annotation.Nullable%> String name = _1.getName();\n final /*@Thrown\052/ boolean eq = (name != null) ? name.equals(entryName) : (entryName == null);\n //\n if (eq == <%org.eclipse.ocl.pivot.utilities.ValueUtil%>.TRUE_VALUE) {\n accumulator.add(_1);\n }\n}\n/*@Thrown\052/ <%org.eclipse.ocl.pivot.values.SequenceValue%>.@org.eclipse.jdt.annotation.NonNull Accumulator accumulator_0 = <%org.eclipse.ocl.pivot.utilities.ValueUtil%>.createSequenceAccumulatorValue(<%example2.classes.lookup.EnvironmentTables%>.SEQ_CLSSid_NamedElement);\n@<%org.eclipse.jdt.annotation.Nullable%> <%java.util.Iterator%><?> ITERATOR__1_0 = entry.iterator();\n/*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> SequenceValue collect;\nwhile (true) {\n if (!ITERATOR__1_0.hasNext()) {\n collect = accumulator_0;\n break;\n }\n /*@NonInvalid\052/ example2.classes.lookup.@<%org.eclipse.jdt.annotation.Nullable%> EnvEntry _1_0 = (<%example2.classes.lookup.EnvEntry%>)ITERATOR__1_0.next();\n /**\n * namedElements\n \052/\n if (_1_0 == null) {\n throw new <%org.eclipse.ocl.pivot.values.InvalidValueException%>(\"Null source for \\\'\\\'http://cs2as/tests/example2/env/1.0\\\'::EnvEntry::namedElements\\\'\");\n }\n @SuppressWarnings(\"null\")\n final /*@Thrown\052/ java.util.@<%org.eclipse.jdt.annotation.NonNull%> List<<%example2.classes.NamedElement%>> namedElements = _1_0.getNamedElements();\n final /*@Thrown\052/ org.eclipse.ocl.pivot.values.@<%org.eclipse.jdt.annotation.NonNull%> OrderedSetValue BOXED_namedElements = idResolver.createOrderedSetOfAll(<%example2.classes.lookup.EnvironmentTables%>.ORD_CLSSid_NamedElement, namedElements);\n //\n for (Object value : BOXED_namedElements.flatten().getElements()) {\n accumulator_0.add(value);\n }\n}\nfinal /*@Thrown\052/ java.util.@<%org.eclipse.jdt.annotation.NonNull%> List<<%example2.classes.NamedElement%>> ECORE_collect = ((<%org.eclipse.ocl.pivot.ids.IdResolver%>.IdResolverExtension)idResolver).ecoreValueOfAll(<%example2.classes.NamedElement%>.class, collect);\nreturn (<%org.eclipse.emf.common.util.EList%><<%example2.classes.NamedElement%>>)ECORE_collect;'" + * @generated + */ + EList<NamedElement> getNamedElements(String entryName); + } // LookupEnvironment diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvEntryImpl.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvEntryImpl.java new file mode 100644 index 000000000..842585112 --- /dev/null +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvEntryImpl.java @@ -0,0 +1,307 @@ +/** + */ +package example2.classes.lookup.impl; + +import example2.classes.NamedElement; + +import example2.classes.lookup.EnvEntry; +import example2.classes.lookup.EnvironmentPackage; +import example2.classes.lookup.LookupEnvironment; + +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.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.EcoreUtil; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Env Entry</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * </p> + * <ul> + * <li>{@link example2.classes.lookup.impl.EnvEntryImpl#getName <em>Name</em>}</li> + * <li>{@link example2.classes.lookup.impl.EnvEntryImpl#getNamedElements <em>Named Elements</em>}</li> + * <li>{@link example2.classes.lookup.impl.EnvEntryImpl#getEnv <em>Env</em>}</li> + * </ul> + * + * @generated + */ +public class EnvEntryImpl extends MinimalEObjectImpl.Container implements EnvEntry { + /** + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getNamedElements() <em>Named Elements</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getNamedElements() + * @generated + * @ordered + */ + protected EList<NamedElement> namedElements; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EnvEntryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return EnvironmentPackage.Literals.ENV_ENTRY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EnvironmentPackage.ENV_ENTRY__NAME, oldName, name)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<NamedElement> getNamedElements() { + if (namedElements == null) { + namedElements = new EObjectResolvingEList<NamedElement>(NamedElement.class, this, EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS); + } + return namedElements; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public LookupEnvironment getEnv() { + if (eContainerFeatureID() != EnvironmentPackage.ENV_ENTRY__ENV) return null; + return (LookupEnvironment)eInternalContainer(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetEnv(LookupEnvironment newEnv, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newEnv, EnvironmentPackage.ENV_ENTRY__ENV, msgs); + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setEnv(LookupEnvironment newEnv) { + if (newEnv != eInternalContainer() || (eContainerFeatureID() != EnvironmentPackage.ENV_ENTRY__ENV && newEnv != null)) { + if (EcoreUtil.isAncestor(this, newEnv)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newEnv != null) + msgs = ((InternalEObject)newEnv).eInverseAdd(this, EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES, LookupEnvironment.class, msgs); + msgs = basicSetEnv(newEnv, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, EnvironmentPackage.ENV_ENTRY__ENV, newEnv, newEnv)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EnvironmentPackage.ENV_ENTRY__ENV: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetEnv((LookupEnvironment)otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EnvironmentPackage.ENV_ENTRY__ENV: + return basicSetEnv(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case EnvironmentPackage.ENV_ENTRY__ENV: + return eInternalContainer().eInverseRemove(this, EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES, LookupEnvironment.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EnvironmentPackage.ENV_ENTRY__NAME: + return getName(); + case EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS: + return getNamedElements(); + case EnvironmentPackage.ENV_ENTRY__ENV: + return getEnv(); + } + 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 EnvironmentPackage.ENV_ENTRY__NAME: + setName((String)newValue); + return; + case EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS: + getNamedElements().clear(); + getNamedElements().addAll((Collection<? extends NamedElement>)newValue); + return; + case EnvironmentPackage.ENV_ENTRY__ENV: + setEnv((LookupEnvironment)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EnvironmentPackage.ENV_ENTRY__NAME: + setName(NAME_EDEFAULT); + return; + case EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS: + getNamedElements().clear(); + return; + case EnvironmentPackage.ENV_ENTRY__ENV: + setEnv((LookupEnvironment)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EnvironmentPackage.ENV_ENTRY__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case EnvironmentPackage.ENV_ENTRY__NAMED_ELEMENTS: + return namedElements != null && !namedElements.isEmpty(); + case EnvironmentPackage.ENV_ENTRY__ENV: + return getEnv() != 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(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + + +} //EnvEntryImpl diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvironmentFactoryImpl.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvironmentFactoryImpl.java index e9e15e513..54c315f9e 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvironmentFactoryImpl.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvironmentFactoryImpl.java @@ -2,6 +2,7 @@ */ package example2.classes.lookup.impl; +import example2.classes.lookup.*; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; @@ -57,6 +58,7 @@ public class EnvironmentFactoryImpl extends EFactoryImpl implements EnvironmentF public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case EnvironmentPackage.LOOKUP_ENVIRONMENT: return createLookupEnvironment(); + case EnvironmentPackage.ENV_ENTRY: return createEnvEntry(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -77,6 +79,16 @@ public class EnvironmentFactoryImpl extends EFactoryImpl implements EnvironmentF * <!-- end-user-doc --> * @generated */ + public EnvEntry createEnvEntry() { + EnvEntryImpl envEntry = new EnvEntryImpl(); + return envEntry; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EnvironmentPackage getEnvironmentPackage() { return (EnvironmentPackage)getEPackage(); } diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvironmentPackageImpl.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvironmentPackageImpl.java index 02b04b308..48b804e59 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvironmentPackageImpl.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/EnvironmentPackageImpl.java @@ -15,9 +15,11 @@ import org.eclipse.ocl.pivot.oclstdlib.OCLstdlibPackage; import example2.classes.ClassesPackage; import example2.classes.impl.ClassesPackageImpl; import example2.classes.lookup.Env4CG; +import example2.classes.lookup.EnvEntry; import example2.classes.lookup.EnvironmentFactory; import example2.classes.lookup.EnvironmentPackage; import example2.classes.lookup.LookupEnvironment; +import org.eclipse.emf.ecore.EAttribute; /** * <!-- begin-user-doc --> @@ -45,6 +47,13 @@ public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentP * <!-- end-user-doc --> * @generated */ + private EClass envEntryEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ private EClass executorEClass = null; /** @@ -128,7 +137,7 @@ public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentP * <!-- end-user-doc --> * @generated */ - public EReference getLookupEnvironment_NamedElements() { + public EReference getLookupEnvironment_Entries() { return (EReference)lookupEnvironmentEClass.getEStructuralFeatures().get(0); } @@ -164,6 +173,24 @@ public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentP * <!-- end-user-doc --> * @generated */ + public EOperation getLookupEnvironment__AddElementWithName__String_NamedElement() { + return lookupEnvironmentEClass.getEOperations().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EOperation getLookupEnvironment__GetNamedElements__String() { + return lookupEnvironmentEClass.getEOperations().get(3); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EClass getEnv4CG() { return env4CGEClass; } @@ -191,6 +218,42 @@ public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentP * <!-- end-user-doc --> * @generated */ + public EClass getEnvEntry() { + return envEntryEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getEnvEntry_Name() { + return (EAttribute)envEntryEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEnvEntry_NamedElements() { + return (EReference)envEntryEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getEnvEntry_Env() { + return (EReference)envEntryEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EClass getExecutor() { return executorEClass; } @@ -224,15 +287,22 @@ public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentP // Create classes and their features lookupEnvironmentEClass = createEClass(LOOKUP_ENVIRONMENT); - createEReference(lookupEnvironmentEClass, LOOKUP_ENVIRONMENT__NAMED_ELEMENTS); + createEReference(lookupEnvironmentEClass, LOOKUP_ENVIRONMENT__ENTRIES); createEReference(lookupEnvironmentEClass, LOOKUP_ENVIRONMENT__PARENT_ENV); createEOperation(lookupEnvironmentEClass, LOOKUP_ENVIRONMENT___ADD_ELEMENTS__COLLECTION); createEOperation(lookupEnvironmentEClass, LOOKUP_ENVIRONMENT___ADD_ELEMENT__NAMEDELEMENT); + createEOperation(lookupEnvironmentEClass, LOOKUP_ENVIRONMENT___ADD_ELEMENT_WITH_NAME__STRING_NAMEDELEMENT); + createEOperation(lookupEnvironmentEClass, LOOKUP_ENVIRONMENT___GET_NAMED_ELEMENTS__STRING); env4CGEClass = createEClass(ENV4_CG); createEOperation(env4CGEClass, ENV4_CG___HAS_FINAL_RESULT); createEOperation(env4CGEClass, ENV4_CG___GET_EXECUTOR); + envEntryEClass = createEClass(ENV_ENTRY); + createEAttribute(envEntryEClass, ENV_ENTRY__NAME); + createEReference(envEntryEClass, ENV_ENTRY__NAMED_ELEMENTS); + createEReference(envEntryEClass, ENV_ENTRY__ENV); + executorEClass = createEClass(EXECUTOR); } @@ -272,7 +342,7 @@ public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentP // Initialize classes, features, and operations; add parameters initEClass(lookupEnvironmentEClass, LookupEnvironment.class, "LookupEnvironment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEReference(getLookupEnvironment_NamedElements(), theClassesPackage.getNamedElement(), null, "namedElements", null, 0, -1, LookupEnvironment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getLookupEnvironment_Entries(), this.getEnvEntry(), this.getEnvEntry_Env(), "entries", null, 0, -1, LookupEnvironment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getLookupEnvironment_ParentEnv(), this.getLookupEnvironment(), null, "parentEnv", null, 0, 1, LookupEnvironment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); EOperation op = initEOperation(getLookupEnvironment__AddElements__Collection(), this.getLookupEnvironment(), "addElements", 1, 1, IS_UNIQUE, IS_ORDERED); @@ -285,7 +355,14 @@ public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentP addEParameter(op, g1, "elements", 1, 1, IS_UNIQUE, IS_ORDERED); op = initEOperation(getLookupEnvironment__AddElement__NamedElement(), this.getLookupEnvironment(), "addElement", 1, 1, IS_UNIQUE, IS_ORDERED); - addEParameter(op, theClassesPackage.getNamedElement(), "element", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theClassesPackage.getNamedElement(), "element", 1, 1, IS_UNIQUE, IS_ORDERED); + + op = initEOperation(getLookupEnvironment__AddElementWithName__String_NamedElement(), this.getLookupEnvironment(), "addElementWithName", 1, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "entryName", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theClassesPackage.getNamedElement(), "element", 1, 1, IS_UNIQUE, IS_ORDERED); + + op = initEOperation(getLookupEnvironment__GetNamedElements__String(), theClassesPackage.getNamedElement(), "getNamedElements", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "entryName", 0, 1, IS_UNIQUE, IS_ORDERED); initEClass(env4CGEClass, Env4CG.class, "Env4CG", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -293,6 +370,11 @@ public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentP initEOperation(getEnv4CG__GetExecutor(), this.getExecutor(), "getExecutor", 0, 1, IS_UNIQUE, IS_ORDERED); + initEClass(envEntryEClass, EnvEntry.class, "EnvEntry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getEnvEntry_Name(), ecorePackage.getEString(), "name", null, 0, 1, EnvEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getEnvEntry_NamedElements(), theClassesPackage.getNamedElement(), null, "namedElements", null, 1, -1, EnvEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getEnvEntry_Env(), this.getLookupEnvironment(), this.getLookupEnvironment_Entries(), "env", null, 0, 1, EnvEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(executorEClass, Executor.class, "Executor", IS_ABSTRACT, IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); // Create resource diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/LookupEnvironmentImpl.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/LookupEnvironmentImpl.java index 153e06bf9..f23d15523 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/LookupEnvironmentImpl.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/impl/LookupEnvironmentImpl.java @@ -4,24 +4,32 @@ package example2.classes.lookup.impl; import java.lang.reflect.InvocationTargetException; import java.util.Collection; +import java.util.Iterator; 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.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.ocl.pivot.evaluation.Executor; +import org.eclipse.ocl.pivot.ids.IdResolver; import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal; -import org.eclipse.ocl.pivot.library.collection.CollectionIncludingAllOperation; +import org.eclipse.ocl.pivot.library.collection.CollectionExcludingOperation; import org.eclipse.ocl.pivot.library.collection.CollectionIncludingOperation; +import org.eclipse.ocl.pivot.utilities.ValueUtil; +import org.eclipse.ocl.pivot.values.InvalidValueException; import org.eclipse.ocl.pivot.values.OrderedSetValue; +import org.eclipse.ocl.pivot.values.SequenceValue; import example2.classes.NamedElement; +import example2.classes.lookup.EnvEntry; import example2.classes.lookup.EnvironmentPackage; import example2.classes.lookup.EnvironmentTables; import example2.classes.lookup.LookupEnvironment; @@ -34,7 +42,7 @@ import example2.classes.lookup.LookupEnvironment; * The following features are implemented: * </p> * <ul> - * <li>{@link example2.classes.lookup.impl.LookupEnvironmentImpl#getNamedElements <em>Named Elements</em>}</li> + * <li>{@link example2.classes.lookup.impl.LookupEnvironmentImpl#getEntries <em>Entries</em>}</li> * <li>{@link example2.classes.lookup.impl.LookupEnvironmentImpl#getParentEnv <em>Parent Env</em>}</li> * </ul> * @@ -42,14 +50,14 @@ import example2.classes.lookup.LookupEnvironment; */ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implements LookupEnvironment { /** - * The cached value of the '{@link #getNamedElements() <em>Named Elements</em>}' reference list. + * The cached value of the '{@link #getEntries() <em>Entries</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #getNamedElements() + * @see #getEntries() * @generated * @ordered */ - protected EList<NamedElement> namedElements; + protected EList<EnvEntry> entries; /** * The cached value of the '{@link #getParentEnv() <em>Parent Env</em>}' reference. @@ -85,11 +93,11 @@ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implemen * <!-- end-user-doc --> * @generated */ - public EList<NamedElement> getNamedElements() { - if (namedElements == null) { - namedElements = new EObjectResolvingEList<NamedElement>(NamedElement.class, this, EnvironmentPackage.LOOKUP_ENVIRONMENT__NAMED_ELEMENTS); + public EList<EnvEntry> getEntries() { + if (entries == null) { + entries = new EObjectContainmentWithInverseEList<EnvEntry>(EnvEntry.class, this, EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES, EnvironmentPackage.ENV_ENTRY__ENV); } - return namedElements; + return entries; } /** @@ -138,27 +146,33 @@ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implemen public <NE extends NamedElement> LookupEnvironment addElements(final Collection<NE> elements) { /** * - * LookupEnvironment{ - * namedElements = namedElements->includingAll(elements), parentEnv = parentEnv - * } + * elements->iterate(x; acc : LookupEnvironment[?] = self | + * acc.addElement(x)) */ final /*@NonInvalid*/ org.eclipse.ocl.pivot.evaluation.@NonNull Executor executor = PivotUtilInternal.getExecutor(this); final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@NonNull IdResolver idResolver = executor.getIdResolver(); - final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Property CTORid_namedElements = idResolver.getProperty(EnvironmentTables.PROPid_namedElements); - final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Property CTORid_parentEnv = idResolver.getProperty(EnvironmentTables.PROPid_parentEnv); - final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class TYP_lookup_c_c_LookupEnvironment_0 = idResolver.getClass(EnvironmentTables.CLSSid_LookupEnvironment, null); - final /*@Thrown*/ example2.classes.lookup.@NonNull LookupEnvironment symbol_0 = (LookupEnvironment)TYP_lookup_c_c_LookupEnvironment_0.createInstance(); - @SuppressWarnings("null") - final /*@Thrown*/ java.util.@NonNull List<NamedElement> namedElements = this.getNamedElements(); - final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue BOXED_namedElements = idResolver.createOrderedSetOfAll(EnvironmentTables.ORD_CLSSid_NamedElement, namedElements); final /*@NonInvalid*/ org.eclipse.ocl.pivot.values.@NonNull CollectionValue BOXED_elements = idResolver.createCollectionOfAll(EnvironmentTables.COL_TMPLid_, elements); - final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull CollectionValue includingAll = CollectionIncludingAllOperation.INSTANCE.evaluate(BOXED_namedElements, BOXED_elements); - final List<? extends Object> UNBOXED_includingAll = includingAll.asEcoreObjects(idResolver, Object.class); - assert UNBOXED_includingAll != null; - CTORid_namedElements.initValue(symbol_0, UNBOXED_includingAll); - final /*@Thrown*/ example2.classes.lookup.@Nullable LookupEnvironment parentEnv = this.getParentEnv(); - CTORid_parentEnv.initValue(symbol_0, parentEnv); - return symbol_0; + /*@NonInvalid*/ example2.classes.lookup.@NonNull LookupEnvironment acc = this; + @Nullable Iterator<?> ITERATOR_x = BOXED_elements.iterator(); + /*@Thrown*/ example2.classes.lookup.@Nullable LookupEnvironment iterate; + while (true) { + if (!ITERATOR_x.hasNext()) { + iterate = acc; + break; + } + /*@NonInvalid*/ example2.classes.@Nullable NamedElement x = (NamedElement)ITERATOR_x.next(); + /** + * acc.addElement(x) + */ + @SuppressWarnings("null") + final /*@Thrown*/ example2.classes.lookup.@NonNull LookupEnvironment addElement = acc.addElement(x); + // + acc = addElement; + } + if (iterate == null) { + throw new InvalidValueException("Null body for \'lookup::LookupEnvironment::addElements(NE)(Collection(addElements.NE)) : lookup::LookupEnvironment[1]\'"); + } + return iterate; } /** @@ -168,27 +182,188 @@ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implemen */ public LookupEnvironment addElement(final NamedElement element) { /** + * addElementWithName(element.name, element) + */ + final /*@Thrown*/ java.lang.@Nullable String name = element.getName(); + @SuppressWarnings("null") + final /*@Thrown*/ example2.classes.lookup.@NonNull LookupEnvironment addElementWithName = this.addElementWithName(name, element); + return addElementWithName; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public LookupEnvironment addElementWithName(final String entryName, final NamedElement element) { + /** * - * LookupEnvironment{ - * namedElements = namedElements->including(element), parentEnv = parentEnv - * } + * let entry : OrderedSet(lookup::EnvEntry) = entries->select(name = entryName) + * in + * LookupEnvironment{ + * entries = if entry = null + * then + * entries->including( + * EnvEntry{name = entryName, namedElements = OrderedSet{element} + * }) + * else + * entries->excluding(entry) + * ->including( + * EnvEntry{ + * name = entryName, namedElements = entry.namedElements->including(element) + * }) + * endif + * } */ final /*@NonInvalid*/ org.eclipse.ocl.pivot.evaluation.@NonNull Executor executor = PivotUtilInternal.getExecutor(this); final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@NonNull IdResolver idResolver = executor.getIdResolver(); - final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Property CTORid_namedElements = idResolver.getProperty(EnvironmentTables.PROPid_namedElements); - final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Property CTORid_parentEnv = idResolver.getProperty(EnvironmentTables.PROPid_parentEnv); + @SuppressWarnings("null") + final /*@Thrown*/ java.util.@NonNull List<EnvEntry> entries = this.getEntries(); + final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue BOXED_entries = idResolver.createOrderedSetOfAll(EnvironmentTables.ORD_CLSSid_EnvEntry, entries); + /*@Thrown*/ OrderedSetValue.@org.eclipse.jdt.annotation.NonNull Accumulator accumulator = ValueUtil.createOrderedSetAccumulatorValue(EnvironmentTables.ORD_CLSSid_EnvEntry); + @Nullable Iterator<?> ITERATOR__1 = BOXED_entries.iterator(); + /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue entry; + while (true) { + if (!ITERATOR__1.hasNext()) { + entry = accumulator; + break; + } + /*@NonInvalid*/ example2.classes.lookup.@Nullable EnvEntry _1 = (EnvEntry)ITERATOR__1.next(); + /** + * name = entryName + */ + if (_1 == null) { + throw new InvalidValueException("Null source for \'\'http://cs2as/tests/example2/env/1.0\'::EnvEntry::name\'"); + } + final /*@Thrown*/ java.lang.@Nullable String name = _1.getName(); + final /*@Thrown*/ boolean eq = (name != null) ? name.equals(entryName) : (entryName == null); + // + if (eq == ValueUtil.TRUE_VALUE) { + accumulator.add(_1); + } + } + final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Property CTORid_name_0 = idResolver.getProperty(EnvironmentTables.PROPid_name); + final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class TYP_lookup_c_c_EnvEntry_1 = idResolver.getClass(EnvironmentTables.CLSSid_EnvEntry, null); final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class TYP_lookup_c_c_LookupEnvironment_0 = idResolver.getClass(EnvironmentTables.CLSSid_LookupEnvironment, null); - final /*@Thrown*/ example2.classes.lookup.@NonNull LookupEnvironment symbol_0 = (LookupEnvironment)TYP_lookup_c_c_LookupEnvironment_0.createInstance(); + final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Property CTORid_entries = idResolver.getProperty(EnvironmentTables.PROPid_entries); + final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Property CTORid_namedElements_0 = idResolver.getProperty(EnvironmentTables.PROPid_namedElements); + final /*@Thrown*/ example2.classes.lookup.@NonNull LookupEnvironment symbol_3 = (LookupEnvironment)TYP_lookup_c_c_LookupEnvironment_0.createInstance(); + final /*@Thrown*/ boolean eq_0 = false; + /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue symbol_2; + if (eq_0) { + final /*@Thrown*/ example2.classes.lookup.@NonNull EnvEntry symbol_0 = (EnvEntry)TYP_lookup_c_c_EnvEntry_1.createInstance(); + CTORid_name_0.initValue(symbol_0, entryName); + final /*@NonInvalid*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue OrderedSet = ValueUtil.createOrderedSetOfEach(EnvironmentTables.ORD_CLSSid_NamedElement, element); + final List<NamedElement> UNBOXED_OrderedSet = OrderedSet.asEcoreObjects(idResolver, NamedElement.class); + assert UNBOXED_OrderedSet != null; + CTORid_namedElements_0.initValue(symbol_0, UNBOXED_OrderedSet); + final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue including = (OrderedSetValue)CollectionIncludingOperation.INSTANCE.evaluate(BOXED_entries, symbol_0); + symbol_2 = including; + } + else { + final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue excluding = (OrderedSetValue)CollectionExcludingOperation.INSTANCE.evaluate(BOXED_entries, entry); + final /*@Thrown*/ example2.classes.lookup.@NonNull EnvEntry symbol_1 = (EnvEntry)TYP_lookup_c_c_EnvEntry_1.createInstance(); + CTORid_name_0.initValue(symbol_1, entryName); + /*@Thrown*/ SequenceValue.@org.eclipse.jdt.annotation.NonNull Accumulator accumulator_0 = ValueUtil.createSequenceAccumulatorValue(EnvironmentTables.SEQ_CLSSid_NamedElement); + @Nullable Iterator<?> ITERATOR__1_0 = entry.iterator(); + /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull SequenceValue collect; + while (true) { + if (!ITERATOR__1_0.hasNext()) { + collect = accumulator_0; + break; + } + /*@NonInvalid*/ example2.classes.lookup.@Nullable EnvEntry _1_0 = (EnvEntry)ITERATOR__1_0.next(); + /** + * namedElements + */ + if (_1_0 == null) { + throw new InvalidValueException("Null source for \'\'http://cs2as/tests/example2/env/1.0\'::EnvEntry::namedElements\'"); + } + @SuppressWarnings("null") + final /*@Thrown*/ java.util.@NonNull List<NamedElement> namedElements_0 = _1_0.getNamedElements(); + final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue BOXED_namedElements_0 = idResolver.createOrderedSetOfAll(EnvironmentTables.ORD_CLSSid_NamedElement, namedElements_0); + // + for (Object value : BOXED_namedElements_0.flatten().getElements()) { + accumulator_0.add(value); + } + } + final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull SequenceValue including_0 = (SequenceValue)CollectionIncludingOperation.INSTANCE.evaluate(collect, element); + final List<NamedElement> UNBOXED_including_0 = including_0.asEcoreObjects(idResolver, NamedElement.class); + assert UNBOXED_including_0 != null; + CTORid_namedElements_0.initValue(symbol_1, UNBOXED_including_0); + final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue including_1 = (OrderedSetValue)CollectionIncludingOperation.INSTANCE.evaluate(excluding, symbol_1); + symbol_2 = including_1; + } + final List<EnvEntry> UNBOXED_symbol_2 = symbol_2.asEcoreObjects(idResolver, EnvEntry.class); + assert UNBOXED_symbol_2 != null; + CTORid_entries.initValue(symbol_3, UNBOXED_symbol_2); + return symbol_3; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + public EList<NamedElement> getNamedElements(final String entryName) { + /** + * + * let entry : OrderedSet(lookup::EnvEntry) = entries->select(name = entryName) + * in if entry = null then OrderedSet{} else entry.namedElements endif + */ + final /*@NonInvalid*/ org.eclipse.ocl.pivot.evaluation.@NonNull Executor executor = PivotUtilInternal.getExecutor(this); + final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@NonNull IdResolver idResolver = executor.getIdResolver(); @SuppressWarnings("null") - final /*@Thrown*/ java.util.@NonNull List<NamedElement> namedElements = this.getNamedElements(); - final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue BOXED_namedElements = idResolver.createOrderedSetOfAll(EnvironmentTables.ORD_CLSSid_NamedElement, namedElements); - final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue including = (OrderedSetValue)CollectionIncludingOperation.INSTANCE.evaluate(BOXED_namedElements, element); - final List<NamedElement> UNBOXED_including = including.asEcoreObjects(idResolver, NamedElement.class); - assert UNBOXED_including != null; - CTORid_namedElements.initValue(symbol_0, UNBOXED_including); - final /*@Thrown*/ example2.classes.lookup.@Nullable LookupEnvironment parentEnv = this.getParentEnv(); - CTORid_parentEnv.initValue(symbol_0, parentEnv); - return symbol_0; + final /*@Thrown*/ java.util.@NonNull List<EnvEntry> entries = this.getEntries(); + final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue BOXED_entries = idResolver.createOrderedSetOfAll(EnvironmentTables.ORD_CLSSid_EnvEntry, entries); + /*@Thrown*/ OrderedSetValue.@org.eclipse.jdt.annotation.NonNull Accumulator accumulator = ValueUtil.createOrderedSetAccumulatorValue(EnvironmentTables.ORD_CLSSid_EnvEntry); + @Nullable Iterator<?> ITERATOR__1 = BOXED_entries.iterator(); + /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue entry; + while (true) { + if (!ITERATOR__1.hasNext()) { + entry = accumulator; + break; + } + /*@NonInvalid*/ example2.classes.lookup.@Nullable EnvEntry _1 = (EnvEntry)ITERATOR__1.next(); + /** + * name = entryName + */ + if (_1 == null) { + throw new InvalidValueException("Null source for \'\'http://cs2as/tests/example2/env/1.0\'::EnvEntry::name\'"); + } + final /*@Thrown*/ java.lang.@Nullable String name = _1.getName(); + final /*@Thrown*/ boolean eq = (name != null) ? name.equals(entryName) : (entryName == null); + // + if (eq == ValueUtil.TRUE_VALUE) { + accumulator.add(_1); + } + } + /*@Thrown*/ SequenceValue.@org.eclipse.jdt.annotation.NonNull Accumulator accumulator_0 = ValueUtil.createSequenceAccumulatorValue(EnvironmentTables.SEQ_CLSSid_NamedElement); + @Nullable Iterator<?> ITERATOR__1_0 = entry.iterator(); + /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull SequenceValue collect; + while (true) { + if (!ITERATOR__1_0.hasNext()) { + collect = accumulator_0; + break; + } + /*@NonInvalid*/ example2.classes.lookup.@Nullable EnvEntry _1_0 = (EnvEntry)ITERATOR__1_0.next(); + /** + * namedElements + */ + if (_1_0 == null) { + throw new InvalidValueException("Null source for \'\'http://cs2as/tests/example2/env/1.0\'::EnvEntry::namedElements\'"); + } + @SuppressWarnings("null") + final /*@Thrown*/ java.util.@NonNull List<NamedElement> namedElements = _1_0.getNamedElements(); + final /*@Thrown*/ org.eclipse.ocl.pivot.values.@NonNull OrderedSetValue BOXED_namedElements = idResolver.createOrderedSetOfAll(EnvironmentTables.ORD_CLSSid_NamedElement, namedElements); + // + for (Object value : BOXED_namedElements.flatten().getElements()) { + accumulator_0.add(value); + } + } + final /*@Thrown*/ java.util.@NonNull List<NamedElement> ECORE_collect = ((IdResolver.IdResolverExtension)idResolver).ecoreValueOfAll(NamedElement.class, collect); + return (EList<NamedElement>)ECORE_collect; } /** @@ -214,11 +389,40 @@ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implemen * <!-- end-user-doc --> * @generated */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES: + return ((InternalEList<InternalEObject>)(InternalEList<?>)getEntries()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES: + return ((InternalEList<?>)getEntries()).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 EnvironmentPackage.LOOKUP_ENVIRONMENT__NAMED_ELEMENTS: - return getNamedElements(); + case EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES: + return getEntries(); case EnvironmentPackage.LOOKUP_ENVIRONMENT__PARENT_ENV: if (resolve) return getParentEnv(); return basicGetParentEnv(); @@ -235,9 +439,9 @@ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implemen @Override public void eSet(int featureID, Object newValue) { switch (featureID) { - case EnvironmentPackage.LOOKUP_ENVIRONMENT__NAMED_ELEMENTS: - getNamedElements().clear(); - getNamedElements().addAll((Collection<? extends NamedElement>)newValue); + case EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES: + getEntries().clear(); + getEntries().addAll((Collection<? extends EnvEntry>)newValue); return; case EnvironmentPackage.LOOKUP_ENVIRONMENT__PARENT_ENV: setParentEnv((LookupEnvironment)newValue); @@ -254,8 +458,8 @@ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implemen @Override public void eUnset(int featureID) { switch (featureID) { - case EnvironmentPackage.LOOKUP_ENVIRONMENT__NAMED_ELEMENTS: - getNamedElements().clear(); + case EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES: + getEntries().clear(); return; case EnvironmentPackage.LOOKUP_ENVIRONMENT__PARENT_ENV: setParentEnv((LookupEnvironment)null); @@ -272,8 +476,8 @@ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implemen @Override public boolean eIsSet(int featureID) { switch (featureID) { - case EnvironmentPackage.LOOKUP_ENVIRONMENT__NAMED_ELEMENTS: - return namedElements != null && !namedElements.isEmpty(); + case EnvironmentPackage.LOOKUP_ENVIRONMENT__ENTRIES: + return entries != null && !entries.isEmpty(); case EnvironmentPackage.LOOKUP_ENVIRONMENT__PARENT_ENV: return parentEnv != null; } @@ -293,6 +497,10 @@ public class LookupEnvironmentImpl extends MinimalEObjectImpl.Container implemen return addElements((Collection)arguments.get(0)); case EnvironmentPackage.LOOKUP_ENVIRONMENT___ADD_ELEMENT__NAMEDELEMENT: return addElement((NamedElement)arguments.get(0)); + case EnvironmentPackage.LOOKUP_ENVIRONMENT___ADD_ELEMENT_WITH_NAME__STRING_NAMEDELEMENT: + return addElementWithName((String)arguments.get(0), (NamedElement)arguments.get(1)); + case EnvironmentPackage.LOOKUP_ENVIRONMENT___GET_NAMED_ELEMENTS__STRING: + return getNamedElements((String)arguments.get(0)); case EnvironmentPackage.LOOKUP_ENVIRONMENT___HAS_FINAL_RESULT: return hasFinalResult(); case EnvironmentPackage.LOOKUP_ENVIRONMENT___GET_EXECUTOR: diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/util/EnvironmentAdapterFactory.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/util/EnvironmentAdapterFactory.java index c27f430a5..6bc7e655c 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/util/EnvironmentAdapterFactory.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/util/EnvironmentAdapterFactory.java @@ -79,6 +79,10 @@ public class EnvironmentAdapterFactory extends AdapterFactoryImpl { return createEnv4CGAdapter(); } @Override + public Adapter caseEnvEntry(EnvEntry object) { + return createEnvEntryAdapter(); + } + @Override public Adapter caseExecutor(Executor object) { return createExecutorAdapter(); } @@ -131,6 +135,20 @@ public class EnvironmentAdapterFactory extends AdapterFactoryImpl { } /** + * Creates a new adapter for an object of class '{@link example2.classes.lookup.EnvEntry <em>Env Entry</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 example2.classes.lookup.EnvEntry + * @generated + */ + public Adapter createEnvEntryAdapter() { + return null; + } + + /** * Creates a new adapter for an object of class '{@link org.eclipse.ocl.pivot.evaluation.Executor <em>Executor</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/util/EnvironmentSwitch.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/util/EnvironmentSwitch.java index bfcbd455f..6c41612fd 100644 --- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/util/EnvironmentSwitch.java +++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/tests-gen/example2/classes/lookup/util/EnvironmentSwitch.java @@ -82,6 +82,12 @@ public class EnvironmentSwitch<@Nullable T> extends Switch<T> { if (result == null) result = defaultCase(theEObject); return result; } + case EnvironmentPackage.ENV_ENTRY: { + EnvEntry envEntry = (EnvEntry)theEObject; + T result = caseEnvEntry(envEntry); + if (result == null) result = defaultCase(theEObject); + return result; + } case EnvironmentPackage.EXECUTOR: { Executor executor = (Executor)theEObject; T result = caseExecutor(executor); @@ -123,6 +129,21 @@ public class EnvironmentSwitch<@Nullable T> extends Switch<T> { } /** + * Returns the result of interpreting the object as an instance of '<em>Env Entry</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>Env Entry</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEnvEntry(EnvEntry object) { + return null; + } + + /** * Returns the result of interpreting the object as an instance of '<em>Executor</em>'. * <!-- begin-user-doc --> * This implementation returns null; |