diff options
6 files changed, 29 insertions, 595 deletions
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/emf-gen/org/eclipse/qvtd/pivot/qvtbase/model/QVTbaseLibrary.java b/plugins/org.eclipse.qvtd.pivot.qvtbase/emf-gen/org/eclipse/qvtd/pivot/qvtbase/model/QVTbaseLibrary.java index 6f4dcc20b..d61af1bfd 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtbase/emf-gen/org/eclipse/qvtd/pivot/qvtbase/model/QVTbaseLibrary.java +++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/emf-gen/org/eclipse/qvtd/pivot/qvtbase/model/QVTbaseLibrary.java @@ -51,10 +51,8 @@ import org.eclipse.ocl.pivot.utilities.MetamodelManager; import org.eclipse.ocl.pivot.utilities.PivotConstants; import org.eclipse.ocl.pivot.utilities.PivotUtil; -import org.eclipse.ocl.pivot.PivotPackage; import org.eclipse.ocl.pivot.oclstdlib.OCLstdlibPackage; import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage; -import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage; /** * This is the http://www.eclipse.org/qvt/2015/QVTbaseLibrary Standard Library @@ -90,7 +88,7 @@ public class QVTbaseLibrary extends ASResourceImpl public static @NonNull QVTbaseLibrary getDefault() { QVTbaseLibrary oclstdlib = INSTANCE; if (oclstdlib == null) { - Contents contents = new Contents("http://www.eclipse.org/qvt/2015/QVTbase"); + Contents contents = new Contents("http://www.eclipse.org/qvt/2015/QVTbaseLibrary"); oclstdlib = INSTANCE = new QVTbaseLibrary(STDLIB_URI + PivotConstants.DOT_OCL_AS_FILE_EXTENSION, contents.getModel()); } return oclstdlib; @@ -236,21 +234,15 @@ public class QVTbaseLibrary extends ASResourceImpl private static class Contents extends AbstractContents { private final @NonNull Model model; - private final @NonNull Library ocl; - private final @NonNull Library qvtbase; - private final @NonNull Package orphanage; + private final @NonNull Library qvtbaselibrary; private Contents(@NonNull String asURI) { model = createModel(asURI); - ocl = createLibrary("ocl", "ocl", "http://www.eclipse.org/ocl/2015/Pivot", IdManager.METAMODEL); - qvtbase = createLibrary("qvtbase", "qvtb", "http://www.eclipse.org/qvt/2015/QVTbase", null); - orphanage = createPackage("$$", "orphanage", "http://www.eclipse.org/ocl/2015/Orphanage", null); + qvtbaselibrary = createLibrary("qvtbaselibrary", "qvtbaselib", "http://www.eclipse.org/qvt/2015/QVTbaseLibrary", null); installPackages(); installClassTypes(); - installCollectionTypes(); installOperations(); - installTemplateBindings(); installComments(); } @@ -259,83 +251,37 @@ public class QVTbaseLibrary extends ASResourceImpl } private final @NonNull Package _ocl = getPackage(org.eclipse.ocl.pivot.model.OCLstdlib.getDefaultModel(), "ocl"); - private final @NonNull Package _qvtbase = getPackage(org.eclipse.qvtd.pivot.qvtbase.model.QVTbaseMetamodel.getDefaultModel(), "qvtbase"); - private final @NonNull CollectionType _Collection = getCollectionType(_ocl, "Collection"); private final @NonNull AnyType _OclAny = getAnyType(_ocl, "OclAny"); private final @NonNull Class _OclElement = getClass(_ocl, "OclElement"); - private final @NonNull SetType _Set = getSetType(_ocl, "Set"); - private final @NonNull Class _TypedModel = getClass(_qvtbase, "TypedModel"); - private final @NonNull CollectionType _UniqueCollection = getCollectionType(_ocl, "UniqueCollection"); - private final @NonNull TemplateParameter _Collection_T = getTemplateParameter(_Collection, 0); - private final @NonNull TemplateParameter _Set_T = getTemplateParameter(_Set, 0); - private final @NonNull TemplateParameter _UniqueCollection_T = getTemplateParameter(_UniqueCollection, 0); + private final @NonNull InvalidType _OclInvalid = getInvalidType(_ocl, "OclInvalid"); private void installPackages() { - model.getOwnedPackages().add(ocl); - model.getOwnedPackages().add(qvtbase); - model.getOwnedPackages().add(orphanage); + model.getOwnedPackages().add(qvtbaselibrary); model.getOwnedImports().add(createImport(_ocl)); } private final @NonNull Class _Model = createClass("Model"); - private final @NonNull Class _Transformation = createClass("Transformation"); private final @NonNull TemplateParameter tp_Model_objectsOfKind_TT = createTemplateParameter("TT"); - private final @NonNull CollectionType _Collection_OclElement = createCollectionType(_Collection, _OclElement); - private final @NonNull CollectionType _Collection_Model_objectsOfKind_TT = createCollectionType(_Collection, tp_Model_objectsOfKind_TT); - private final @NonNull SetType _Set_OclElement = createSetType(_Set, _OclElement); - private final @NonNull SetType _Set_Model_objectsOfKind_TT = createSetType(_Set, tp_Model_objectsOfKind_TT); - private final @NonNull CollectionType _UniqueCollection_OclElement = createCollectionType(_UniqueCollection, _OclElement); - private final @NonNull CollectionType _UniqueCollection_Model_objectsOfKind_TT = createCollectionType(_UniqueCollection, tp_Model_objectsOfKind_TT); - private void installClassTypes() { List<Class> ownedClasses; List<Class> superClasses; Class type; - ownedClasses = ocl.getOwnedClasses(); + ownedClasses = qvtbaselibrary.getOwnedClasses(); ownedClasses.add(type = _Model); superClasses = type.getSuperClasses(); superClasses.add(_OclElement); - - ownedClasses = qvtbase.getOwnedClasses(); ownedClasses.add(type = _Transformation); superClasses = type.getSuperClasses(); superClasses.add(_OclElement); } - private void installCollectionTypes() { - List<Class> ownedClasses; - List<Class> superClasses; - CollectionType type; - - ownedClasses = orphanage.getOwnedClasses(); - ownedClasses.add(type = _Collection_OclElement); - superClasses = type.getSuperClasses(); - superClasses.add(_OclElement); - ownedClasses.add(type = _Collection_Model_objectsOfKind_TT); - superClasses = type.getSuperClasses(); - superClasses.add(_OclElement); - ownedClasses.add(type = _Set_OclElement); - superClasses = type.getSuperClasses(); - superClasses.add(_UniqueCollection_OclElement); - ownedClasses.add(type = _Set_Model_objectsOfKind_TT); - superClasses = type.getSuperClasses(); - superClasses.add(_UniqueCollection_Model_objectsOfKind_TT); - ownedClasses.add(type = _UniqueCollection_OclElement); - superClasses = type.getSuperClasses(); - superClasses.add(_Collection_OclElement); - ownedClasses.add(type = _UniqueCollection_Model_objectsOfKind_TT); - superClasses = type.getSuperClasses(); - superClasses.add(_Collection_Model_objectsOfKind_TT); - } - - private final @NonNull Operation op_Model_objects = createOperation("objects", _Set_OclElement, null, null); - private final @NonNull Operation op_Model_objectsOfKind = createOperation("objectsOfKind", _Set_Model_objectsOfKind_TT, "org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation", org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation.INSTANCE, tp_Model_objectsOfKind_TT); - private final @NonNull Operation op_Model_rootObjects = createOperation("rootObjects", _Set_OclElement, null, null); - private final @NonNull Operation op_Transformation_modelFor = createOperation("modelFor", _Model, "org.eclipse.qvtd.pivot.qvtbase.library.transformation.TransformationModelForOperation", org.eclipse.qvtd.pivot.qvtbase.library.transformation.TransformationModelForOperation.INSTANCE); + private final @NonNull Operation op_Model_objects = createOperation("objects", _OclInvalid, null, null); + private final @NonNull Operation op_Model_objectsOfKind = createOperation("objectsOfKind", _OclInvalid, "org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation", org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation.INSTANCE, tp_Model_objectsOfKind_TT); + private final @NonNull Operation op_Model_rootObjects = createOperation("rootObjects", _OclInvalid, null, null); private void installOperations() { List<Operation> ownedOperations; @@ -350,27 +296,6 @@ public class QVTbaseLibrary extends ASResourceImpl ownedParameters.add(parameter = createParameter("type", tp_Model_objectsOfKind_TT, true)); parameter.setIsTypeof(true); ownedOperations.add(operation = op_Model_rootObjects); - - ownedOperations = _Transformation.getOwnedOperations(); - ownedOperations.add(operation = op_Transformation_modelFor); - operation.setIsRequired(false); - ownedParameters = operation.getOwnedParameters(); - ownedParameters.add(parameter = createParameter("typedModel", _TypedModel, true)); - } - - private void installTemplateBindings() { - _Collection_OclElement.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_Collection_T, _OclElement))); - _Collection_Model_objectsOfKind_TT.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_Collection_T, tp_Model_objectsOfKind_TT))); - _Set_OclElement.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_Set_T, _OclElement))); - _Set_Model_objectsOfKind_TT.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_Set_T, tp_Model_objectsOfKind_TT))); - _UniqueCollection_OclElement.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_UniqueCollection_T, _OclElement))); - _UniqueCollection_Model_objectsOfKind_TT.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_UniqueCollection_T, tp_Model_objectsOfKind_TT))); } private void installComments() { diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/emf-gen/org/eclipse/qvtd/pivot/qvtbase/model/QVTdStdlib.java b/plugins/org.eclipse.qvtd.pivot.qvtbase/emf-gen/org/eclipse/qvtd/pivot/qvtbase/model/QVTdStdlib.java deleted file mode 100644 index 46024ea20..000000000 --- a/plugins/org.eclipse.qvtd.pivot.qvtbase/emf-gen/org/eclipse/qvtd/pivot/qvtbase/model/QVTdStdlib.java +++ /dev/null @@ -1,382 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010,2015 E.D.Willink and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * E.D.Willink - initial API and implementation - ******************************************************************************* - * This code is 100% auto-generated - * from: /org.eclipse.qvtd.pivot.qvtbase/model/QVTd-1.3.oclstdlib - * by: org.eclipse.ocl.examples.build.xtend.generateOCLstdlib.xtend - * and: org.eclipse.ocl.examples.build.GenerateOCLstdlibModel.mwe2 - * - * Do not edit it. - *******************************************************************************/ -package org.eclipse.qvtd.pivot.qvtbase.model; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.WeakHashMap; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.impl.BasicEObjectImpl; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; -import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.ocl.pivot.*; -import org.eclipse.ocl.pivot.Class; -import org.eclipse.ocl.pivot.Package; -import org.eclipse.ocl.pivot.ids.IdManager; -import org.eclipse.ocl.pivot.ids.PackageId; -import org.eclipse.ocl.pivot.internal.library.StandardLibraryContribution; -import org.eclipse.ocl.pivot.internal.resource.ASResourceImpl; -import org.eclipse.ocl.pivot.internal.resource.OCLASResourceFactory; -import org.eclipse.ocl.pivot.internal.utilities.AS2XMIid; -import org.eclipse.ocl.pivot.internal.utilities.AbstractContents; -import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal; -import org.eclipse.ocl.pivot.utilities.ClassUtil; -import org.eclipse.ocl.pivot.utilities.MetamodelManager; -import org.eclipse.ocl.pivot.utilities.PivotConstants; -import org.eclipse.ocl.pivot.utilities.PivotUtil; - -import org.eclipse.ocl.pivot.PivotPackage; -import org.eclipse.ocl.pivot.oclstdlib.OCLstdlibPackage; -import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage; -import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage; - -/** - * This is the http://www.eclipse.org/qvt/2015/QVTdLibrary Standard Library - * auto-generated from /org.eclipse.qvtd.pivot.qvtbase/model/QVTd-1.3.oclstdlib. - * It facilitates efficient library loading without the overheads of model reading. - * <p> - * This Standard Library may be registered as the definition of a Standard Library for - * the OCL evaluation framework by invoking {@link #install}. - * <p> - * The Standard Library is normally activated when the MetamodelManager attempts - * to locate a library type when its default Standard Library URI is the same - * as this Standard Library. - */ -@SuppressWarnings({"nls", "unused"}) -public class QVTdStdlib extends ASResourceImpl -{ - /** - * The static package-of-types pivot model of the Standard Library. - */ - private static QVTdStdlib INSTANCE = null; - - /** - * The URI of this Standard Library. - */ - public static final @NonNull String STDLIB_URI = "http://www.eclipse.org/qvt/2015/QVTdLibrary"; - - /** - * Return the default http://www.eclipse.org/qvt/2015/QVTdLibrary standard Library Resource. - * This static definition auto-generated from /org.eclipse.qvtd.pivot.qvtbase/model/QVTd-1.3.oclstdlib - * is used as the default when no overriding copy is registered. - * It cannot be unloaded or rather unloading has no effect. - */ - public static @NonNull QVTdStdlib getDefault() { - QVTdStdlib oclstdlib = INSTANCE; - if (oclstdlib == null) { - Contents contents = new Contents("http://www.eclipse.org/qvt/2015/QVTbase"); - oclstdlib = INSTANCE = new QVTdStdlib(STDLIB_URI + PivotConstants.DOT_OCL_AS_FILE_EXTENSION, contents.getModel()); - } - return oclstdlib; - } - - /** - * Return the default http://www.eclipse.org/qvt/2015/QVTdLibrary standard Library model. - * This static definition auto-generated from /org.eclipse.qvtd.pivot.qvtbase/model/QVTd-1.3.oclstdlib - * is used as the default when no overriding copy is registered. - */ - public static @NonNull Model getDefaultModel() { - Model model = (Model)(getDefault().getContents().get(0)); - assert model != null; - return model; - } - - /** - * Install this library in the {@link StandardLibraryContribution#REGISTRY}. - * This method may be invoked by standalone applications to replicate - * the registration that should appear as a standard_library plugin - * extension when running within Eclipse. - */ - public static void install() { - StandardLibraryContribution.REGISTRY.put(STDLIB_URI, new Loader()); - } - - /** - * Install this library in the {@link StandardLibraryContribution#REGISTRY} - * unless some other library contribution has already been installed. - */ - public static void lazyInstall() { - if (StandardLibraryContribution.REGISTRY.get(STDLIB_URI) == null) { - install(); - } - } - - /** - * Unnstall this library from the {@link StandardLibraryContribution#REGISTRY}. - * This method may be invoked by standalone applications to release the library - * resources for garbage collection and memory leakage detection. - */ - public static void uninstall() { - StandardLibraryContribution.REGISTRY.remove(STDLIB_URI); - INSTANCE = null; - } - - /** - * The Loader shares the Standard Library instance whenever this default library - * is loaded from the registry of Standard Libraries populated by the standard_library - * extension point. - */ - public static class Loader implements StandardLibraryContribution - { - @Override - public @NonNull StandardLibraryContribution getContribution() { - return this; - } - - @Override - public @NonNull Resource getResource() { - return getDefault(); - } - } - - /** - * Construct a copy of the OCL Standard Library with specified resource URI, - * and package name, prefix and namespace URI. - */ - public static @NonNull QVTdStdlib create(@NonNull String asURI) { - Contents contents = new Contents(asURI); - return new QVTdStdlib(asURI, contents.getModel()); - } - - /** - * Construct an OCL Standard Library with specified resource URI and library content. - */ - private QVTdStdlib(@NonNull String asURI, @NonNull Model libraryModel) { - super(ClassUtil.nonNullState(URI.createURI(asURI)), OCLASResourceFactory.getInstance()); - assert PivotUtilInternal.isASURI(asURI); - getContents().add(libraryModel); - } - - /** - * Overridden to inhibit entry of the static shared instance in any ResourceSet. - */ - @Override - public NotificationChain basicSetResourceSet(ResourceSet resourceSet, NotificationChain notifications) { - if (this != INSTANCE) { - return super.basicSetResourceSet(resourceSet, notifications); - } - else { - return notifications; - } - } - - /** - * Overridden to inhibit unloading of the static shared instance. - */ - @Override - protected void doUnload() { - if (this != INSTANCE) { - super.doUnload(); - } - } - - /** - * Ensure xmi:ids are auto-generated before reference. - */ - @Override - public EObject getEObject(String uriFragment) { - if (getEObjectToIDMap().isEmpty()) { - new AS2XMIid().assignIds(this, null); - } - return super.getEObject(uriFragment); - } - - /** - * Overridden to trivialise loading of the static shared instance. - */ - @Override - public void load(Map<?, ?> options) throws IOException { - if (this != INSTANCE) { - super.load(options); - } - else { - setLoaded(true); - } - } - - /** - * Overridden to inhibit unloading of the static shared instance. - */ - @Override - protected Notification setLoaded(boolean isLoaded) { - if (isLoaded || (this != INSTANCE)) { - return super.setLoaded(isLoaded); - } - else { - return null; - } - } - - private static class Contents extends AbstractContents - { - private final @NonNull Model model; - private final @NonNull Library ocl; - private final @NonNull Library qvtbase; - private final @NonNull Package orphanage; - - private Contents(@NonNull String asURI) - { - model = createModel(asURI); - ocl = createLibrary("ocl", "ocl", "http://www.eclipse.org/ocl/2015/Pivot", IdManager.METAMODEL); - qvtbase = createLibrary("qvtbase", "qvtb", "http://www.eclipse.org/qvt/2015/QVTbase", null); - orphanage = createPackage("$$", "orphanage", "http://www.eclipse.org/ocl/2015/Orphanage", null); - installPackages(); - installClassTypes(); - installCollectionTypes(); - installOperations(); - installTemplateBindings(); - installComments(); - } - - public @NonNull Model getModel() { - return model; - } - - private final @NonNull Model _library = org.eclipse.ocl.pivot.model.OCLstdlib.getDefaultModel(); - private final @NonNull Package _ocl = getLibrary(_library, "ocl"); - private final @NonNull CollectionType _Collection = getCollectionType(_ocl, "Collection"); - private final @NonNull AnyType _OclAny = getAnyType(_ocl, "OclAny"); - private final @NonNull Class _OclElement = getClass(_ocl, "OclElement"); - private final @NonNull SetType _Set = getSetType(_ocl, "Set"); - private final @NonNull CollectionType _UniqueCollection = getCollectionType(_ocl, "UniqueCollection"); - private final @NonNull TemplateParameter _Collection_T = getTemplateParameter(_Collection, 0); - private final @NonNull TemplateParameter _Set_T = getTemplateParameter(_Set, 0); - private final @NonNull TemplateParameter _UniqueCollection_T = getTemplateParameter(_UniqueCollection, 0); - - private void installPackages() { - model.getOwnedPackages().add(ocl); - model.getOwnedPackages().add(qvtbase); - model.getOwnedPackages().add(orphanage); - model.getOwnedImports().add(createImport(_ocl)); - } - - private final @NonNull Class _Model = createClass("Model"); - - private final @NonNull Class _Transformation = createClass("Transformation"); - private final @NonNull Class _TypedModel = createClass("TypedModel"); - - private final @NonNull TemplateParameter tp_Model_objectsOfKind_TT = createTemplateParameter("TT"); - - private final @NonNull CollectionType _Collection_OclElement = createCollectionType(_Collection, _OclElement); - private final @NonNull CollectionType _Collection_Model_objectsOfKind_TT = createCollectionType(_Collection, tp_Model_objectsOfKind_TT); - private final @NonNull SetType _Set_OclElement = createSetType(_Set, _OclElement); - private final @NonNull SetType _Set_Model_objectsOfKind_TT = createSetType(_Set, tp_Model_objectsOfKind_TT); - private final @NonNull CollectionType _UniqueCollection_OclElement = createCollectionType(_UniqueCollection, _OclElement); - private final @NonNull CollectionType _UniqueCollection_Model_objectsOfKind_TT = createCollectionType(_UniqueCollection, tp_Model_objectsOfKind_TT); - - private void installClassTypes() { - List<Class> ownedClasses; - List<Class> superClasses; - Class type; - - ownedClasses = ocl.getOwnedClasses(); - ownedClasses.add(type = _Model); - superClasses = type.getSuperClasses(); - superClasses.add(_OclElement); - - ownedClasses = qvtbase.getOwnedClasses(); - ownedClasses.add(type = _Transformation); - superClasses = type.getSuperClasses(); - superClasses.add(_OclElement); - ownedClasses.add(type = _TypedModel); - superClasses = type.getSuperClasses(); - superClasses.add(_OclElement); - } - - private void installCollectionTypes() { - List<Class> ownedClasses; - List<Class> superClasses; - CollectionType type; - - ownedClasses = orphanage.getOwnedClasses(); - ownedClasses.add(type = _Collection_OclElement); - superClasses = type.getSuperClasses(); - superClasses.add(_OclElement); - ownedClasses.add(type = _Collection_Model_objectsOfKind_TT); - superClasses = type.getSuperClasses(); - superClasses.add(_OclElement); - ownedClasses.add(type = _Set_OclElement); - superClasses = type.getSuperClasses(); - superClasses.add(_UniqueCollection_OclElement); - ownedClasses.add(type = _Set_Model_objectsOfKind_TT); - superClasses = type.getSuperClasses(); - superClasses.add(_UniqueCollection_Model_objectsOfKind_TT); - ownedClasses.add(type = _UniqueCollection_OclElement); - superClasses = type.getSuperClasses(); - superClasses.add(_Collection_OclElement); - ownedClasses.add(type = _UniqueCollection_Model_objectsOfKind_TT); - superClasses = type.getSuperClasses(); - superClasses.add(_Collection_Model_objectsOfKind_TT); - } - - private final @NonNull Operation op_Model_objects = createOperation("objects", _Set_OclElement, null, null); - private final @NonNull Operation op_Model_objectsOfKind = createOperation("objectsOfKind", _Set_Model_objectsOfKind_TT, "org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation", org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation.INSTANCE, tp_Model_objectsOfKind_TT); - private final @NonNull Operation op_Model_rootObjects = createOperation("rootObjects", _Set_OclElement, null, null); - private final @NonNull Operation op_Transformation_modelFor = createOperation("modelFor", _Model, "org.eclipse.qvtd.pivot.qvtbase.library.transformation.TransformationModelForOperation", org.eclipse.qvtd.pivot.qvtbase.library.transformation.TransformationModelForOperation.INSTANCE); - - private void installOperations() { - List<Operation> ownedOperations; - List<Parameter> ownedParameters; - Operation operation; - Parameter parameter; - - ownedOperations = _Model.getOwnedOperations(); - ownedOperations.add(operation = op_Model_objects); - ownedOperations.add(operation = op_Model_objectsOfKind); - ownedParameters = operation.getOwnedParameters(); - ownedParameters.add(parameter = createParameter("type", tp_Model_objectsOfKind_TT, true)); - parameter.setIsTypeof(true); - ownedOperations.add(operation = op_Model_rootObjects); - - ownedOperations = _Transformation.getOwnedOperations(); - ownedOperations.add(operation = op_Transformation_modelFor); - operation.setIsRequired(false); - ownedParameters = operation.getOwnedParameters(); - ownedParameters.add(parameter = createParameter("typedModel", _TypedModel, true)); - } - - private void installTemplateBindings() { - _Collection_OclElement.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_Collection_T, _OclElement))); - _Collection_Model_objectsOfKind_TT.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_Collection_T, tp_Model_objectsOfKind_TT))); - _Set_OclElement.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_Set_T, _OclElement))); - _Set_Model_objectsOfKind_TT.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_Set_T, tp_Model_objectsOfKind_TT))); - _UniqueCollection_OclElement.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_UniqueCollection_T, _OclElement))); - _UniqueCollection_Model_objectsOfKind_TT.getOwnedBindings().add(createTemplateBinding( - createTemplateParameterSubstitution(_UniqueCollection_T, tp_Model_objectsOfKind_TT))); - } - - private void installComments() { - } - } -} diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/model-gen/QVTbaseLibrary.ecore b/plugins/org.eclipse.qvtd.pivot.qvtbase/model-gen/QVTbaseLibrary.ecore index 14f98bc15..911a9a3dc 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtbase/model-gen/QVTbaseLibrary.ecore +++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/model-gen/QVTbaseLibrary.ecore @@ -1,20 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"> - <ecore:EPackage name="qvtbase" nsURI="http://www.eclipse.org/qvt/2015/QVTbase" nsPrefix="qvtb"> - <eAnnotations source="http://www.eclipse.org/OCL/ASLibrary"/> - </ecore:EPackage> - <ecore:EPackage name="ocl" nsURI="http://www.eclipse.org/ocl/2015/Pivot" nsPrefix="ocl"> - <eClassifiers xsi:type="ecore:EClass" name="Model"> - <eOperations name="objects" ordered="false" upperBound="-1"/> - <eOperations name="objectsOfKind" ordered="false" upperBound="-1"> - <eGenericType eTypeParameter="#/1/Model/objectsOfKind/TT"/> - <eTypeParameters name="TT"/> - <eParameters name="type" lowerBound="1"> - <eGenericType eTypeParameter="#/1/Model/objectsOfKind/TT"/> - </eParameters> - </eOperations> - <eOperations name="rootObjects" ordered="false" upperBound="-1"/> - </eClassifiers> - </ecore:EPackage> -</xmi:XMI> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" + name="qvtbaselibrary" nsURI="http://www.eclipse.org/qvt/2015/QVTbaseLibrary" + nsPrefix="qvtbaselib"> + <eAnnotations source="http://www.eclipse.org/OCL/ASLibrary"/> +</ecore:EPackage> diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/model-gen/QVTbaseLibrary.oclas b/plugins/org.eclipse.qvtd.pivot.qvtbase/model-gen/QVTbaseLibrary.oclas index f10e2dbcb..a8a52a8e7 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtbase/model-gen/QVTbaseLibrary.oclas +++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/model-gen/QVTbaseLibrary.oclas @@ -1,61 +1,20 @@ <?xml version="1.0" encoding="UTF-8"?> <pivot:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pivot="http://www.eclipse.org/ocl/2015/Pivot" xsi:schemaLocation="http://www.eclipse.org/ocl/2015/Pivot java://org.eclipse.ocl.pivot.PivotPackage" externalURI="platform:/resource/org.eclipse.qvtd.pivot.qvtbase/model/QVTbaseLibrary.oclstdlib" name="QVTbaseLibrary.oclstdlib"> - <ownedImports importedNamespace="pivot:Package ../model/QVTbase.ecore.oclas#P.qvtbase"/> - <ownedPackages xsi:type="pivot:Library" xmi:id="P.qvtbase" URI="http://www.eclipse.org/qvt/2015/QVTbase" name="qvtbase" nsPrefix="qvtb"> - <ownedClasses xmi:id="T.qvtbase.Transformation" name="Transformation" superClasses="http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement"> - <ownedOperations xmi:id="o.qvtbase.Transformation.modelFor..qvtbase.TypedModel" implementationClass="org.eclipse.qvtd.pivot.qvtbase.library.transformation.TransformationModelForOperation" - isRequired="false" name="modelFor" type="pivot:Class ../../org.eclipse.ocl.pivot/model/Pivot.ecore.oclas#T.pivot.Model"> - <ownedParameters xmi:id="p0o.qvtbase.Transformation.modelFor..qvtbase.TypedModel" name="typedModel" type="pivot:Class ../model/QVTbase.ecore.oclas#T.qvtbase.TypedModel"/> - </ownedOperations> - </ownedClasses> - </ownedPackages> - <ownedPackages xsi:type="pivot:Library" xmi:id="P.ocl" URI="http://www.eclipse.org/ocl/2015/Pivot" name="ocl" nsPrefix="ocl"> - <ownedClasses xmi:id="T.ocl.Model" name="Model" superClasses="http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement"> - <ownedOperations xmi:id="o.ocl.Model.objects" name="objects" type="#//@ownedPackages.2/@ownedClasses.2"/> - <ownedOperations xmi:id="o.ocl.Model.objectsOfKind..TT" implementationClass="org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation" - name="objectsOfKind" type="#//@ownedPackages.2/@ownedClasses.3"> - <ownedParameters xmi:id="p0o.ocl.Model.objectsOfKind..TT" isTypeof="true" name="type" type="#t.ocl.Model..objectsOfKindTT"/> - <ownedSignature xmi:id="s.o.ocl.Model.objectsOfKind..TT"> - <ownedParameters xmi:id="t.ocl.Model..objectsOfKindTT" name="TT"/> + <ownedImports importedNamespace="pivot:Package ../model/QVTbase.ecore.oclas#P.qvtbase" name="qvtb"/> + <ownedPackages xsi:type="pivot:Library" xmi:id="P.qvtbaselibrary" URI="http://www.eclipse.org/qvt/2015/QVTbaseLibrary" name="qvtbaselibrary" + nsPrefix="qvtbaselib"> + <ownedClasses xmi:id="T.qvtbaselibrary.Model" name="Model" superClasses="http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement"> + <ownedOperations xmi:id="o.qvtbaselibrary.Model.objects" name="objects" type="pivot:InvalidType http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclInvalid"/> + <ownedOperations xmi:id="o.qvtbaselibrary.Model.objectsOfKind..TT" implementationClass="org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation" + name="objectsOfKind" type="pivot:InvalidType http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclInvalid"> + <ownedParameters xmi:id="p0o.qvtbaselibrary.Model.objectsOfKind..TT" isTypeof="true" name="type" type="#t.qvtbaselibrary.Model..objectsOfKindTT"/> + <ownedSignature xmi:id="s.o.qvtbaselibrary.Model.objectsOfKind..TT"> + <ownedParameters xmi:id="t.qvtbaselibrary.Model..objectsOfKindTT" name="TT"/> </ownedSignature> </ownedOperations> - <ownedOperations xmi:id="o.ocl.Model.rootObjects" name="rootObjects" type="#//@ownedPackages.2/@ownedClasses.2"/> - </ownedClasses> - </ownedPackages> - <ownedPackages xmi:id="P.$$" URI="http://www.eclipse.org/ocl/2015/Orphanage" name="$$" nsPrefix="orphanage"> - <ownedClasses xsi:type="pivot:CollectionType" elementType="pivot:Class http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement" - name="Collection" superClasses="http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclAny"> - <ownedBindings> - <ownedSubstitutions actual="pivot:Class http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement" formal="http://www.eclipse.org/ocl/2015/Library.oclas#t.ocl..CollectionT"/> - </ownedBindings> - </ownedClasses> - <ownedClasses xsi:type="pivot:CollectionType" elementType="#t.ocl.Model..objectsOfKindTT" name="Collection" superClasses="http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclAny"> - <ownedBindings> - <ownedSubstitutions actual="#t.ocl.Model..objectsOfKindTT" formal="http://www.eclipse.org/ocl/2015/Library.oclas#t.ocl..CollectionT"/> - </ownedBindings> - </ownedClasses> - <ownedClasses xsi:type="pivot:SetType" elementType="pivot:Class http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement" name="Set" - superClasses="#//@ownedPackages.2/@ownedClasses.4"> - <ownedBindings> - <ownedSubstitutions actual="pivot:Class http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement" formal="http://www.eclipse.org/ocl/2015/Library.oclas#t.ocl..SetT"/> - </ownedBindings> - </ownedClasses> - <ownedClasses xsi:type="pivot:SetType" elementType="#t.ocl.Model..objectsOfKindTT" name="Set" superClasses="#//@ownedPackages.2/@ownedClasses.5"> - <ownedBindings> - <ownedSubstitutions actual="#t.ocl.Model..objectsOfKindTT" formal="http://www.eclipse.org/ocl/2015/Library.oclas#t.ocl..SetT"/> - </ownedBindings> - </ownedClasses> - <ownedClasses xsi:type="pivot:CollectionType" elementType="pivot:Class http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement" - name="UniqueCollection" superClasses="#//@ownedPackages.2/@ownedClasses.0"> - <ownedBindings> - <ownedSubstitutions actual="pivot:Class http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement" formal="http://www.eclipse.org/ocl/2015/Library.oclas#t.ocl..UniqueCollectionT"/> - </ownedBindings> - </ownedClasses> - <ownedClasses xsi:type="pivot:CollectionType" elementType="#t.ocl.Model..objectsOfKindTT" name="UniqueCollection" superClasses="#//@ownedPackages.2/@ownedClasses.1"> - <ownedBindings> - <ownedSubstitutions actual="#t.ocl.Model..objectsOfKindTT" formal="http://www.eclipse.org/ocl/2015/Library.oclas#t.ocl..UniqueCollectionT"/> - </ownedBindings> + <ownedOperations xmi:id="o.qvtbaselibrary.Model.rootObjects" name="rootObjects" type="pivot:InvalidType http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclInvalid"/> </ownedClasses> + <ownedClasses xmi:id="T.qvtbaselibrary.Transformation" name="Transformation" superClasses="http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclElement"/> </ownedPackages> </pivot:Model> diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/model/QVTbaseLibrary.oclstdlib b/plugins/org.eclipse.qvtd.pivot.qvtbase/model/QVTbaseLibrary.oclstdlib index bc7fc4a0b..a0f90c782 100644 --- a/plugins/org.eclipse.qvtd.pivot.qvtbase/model/QVTbaseLibrary.oclstdlib +++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/model/QVTbaseLibrary.oclstdlib @@ -1,17 +1,11 @@ -import 'QVTbase.ecore#/'; +import qvtb : 'QVTbase.ecore#/'; -library qvtbase : qvtb = 'http://www.eclipse.org/qvt/2015/QVTbase' -{ -type Transformation { - operation modelFor(typedModel : TypedModel) : ocl::Model[?] => 'org.eclipse.qvtd.pivot.qvtbase.library.transformation.TransformationModelForOperation'; -} -} - -library ocl : ocl = 'http://www.eclipse.org/ocl/2015/Pivot' +library qvtbaselibrary : qvtbaselib = 'http://www.eclipse.org/qvt/2015/QVTbaseLibrary' { type Model { operation objects() : Set(OclElement); operation objectsOfKind(TT)(type : typeof(TT)) : Set(TT) => 'org.eclipse.qvtd.pivot.qvtbase.library.model.ModelObjectsOfKindOperation'; operation rootObjects() : Set(OclElement); } +type Transformation {} } diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/library/transformation/TransformationModelForOperation.java b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/library/transformation/TransformationModelForOperation.java deleted file mode 100644 index 4865f3e7b..000000000 --- a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/library/transformation/TransformationModelForOperation.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2013 E.D.Willink and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * E.D.Willink - Initial API and implementation - *******************************************************************************/ -package org.eclipse.qvtd.pivot.qvtbase.library.transformation; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.ocl.pivot.evaluation.Evaluator; -import org.eclipse.ocl.pivot.evaluation.ModelManager; -import org.eclipse.ocl.pivot.ids.CollectionTypeId; -import org.eclipse.ocl.pivot.ids.TypeId; -import org.eclipse.ocl.pivot.library.AbstractUnaryOperation; -import org.eclipse.ocl.pivot.values.SetValue; - -/** - * ClassifierAllInstancesOperation realises the Classifier::allInstances() library operation. - */ -public class TransformationModelForOperation extends AbstractUnaryOperation -{ - public static final @NonNull TransformationModelForOperation INSTANCE = new TransformationModelForOperation(); - - @Override - public @NonNull SetValue evaluate(@NonNull Evaluator evaluator, @NonNull TypeId returnTypeId, @Nullable Object sourceVal) { - org.eclipse.ocl.pivot.Class type = asClass(sourceVal); -// if (type instanceof DomainMetaclass) { -// type = ((DomainMetaclass)type).getInstanceType(); -// } - ModelManager modelManager = evaluator.getModelManager(); - Set<Object> results = new HashSet<Object>(); - Set<?> instances = modelManager.get(type); - for (Object instance : instances) { - if (instance != null){ - results.add(evaluator.getIdResolver().boxedValueOf(instance)); // FIXME Move to model manager - } - } - return createSetValue((CollectionTypeId)returnTypeId, results); - } -} |