| [comment encoding = UTF-8 /] |
| [module org::eclipse::ocl::examples::build::acceleo::generateOclMetaModel('http://www.eclipse.org/ocl/3.1.0/Pivot','http://www.eclipse.org/emf/2002/Ecore') extends org::eclipse::ocl::examples::build::acceleo::generateOclCommon/] |
| |
| [template public generate(pkg : Package, javaPackage : String, javaClass : String, sourceFile : String, uri : String)] |
| [comment @main /] |
| [let allEnumerations : Sequence(Enumeration) = pkg.eAllContents(Enumeration)] |
| [let allLambdaTypes : Sequence(LambdaType) = pkg.eAllContents(LambdaType)] |
| [let allTupleTypes : Sequence(TupleType) = pkg.eAllContents(TupleType)] |
| [file (javaClass + '.java', false, 'UTF-8')] |
| /** |
| * <copyright> |
| * |
| * Copyright (c) 2010 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 |
| * |
| * </copyright> |
| * |
| * This code is auto-generated |
| * from: [sourceFile/] |
| * by: org.eclipse.ocl.examples.build.acceleo.GenerateOclMetaModel.java |
| * defined by: org.eclipse.ocl.examples.build.acceleo.generateOclMetaModel.mtl |
| * invoked by: org.eclipse.ocl.examples.build.utilities.OclMetaModelCodeGenerator.java |
| * from: org.eclipse.ocl.examples.build.GenerateOclMetaModel.mwe2 |
| * |
| * Do not edit it. |
| * |
| * ['$' + 'I' + 'd' + '$'/] |
| */ |
| package [javaPackage/]; |
| |
| import java.math.BigInteger; |
| import java.util.List; |
| |
| import org.eclipse.emf.common.util.URI; |
| import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; |
| import org.eclipse.ocl.examples.domain.library.LibraryFeature; |
| import org.eclipse.ocl.examples.pivot.*; |
| import org.eclipse.ocl.examples.pivot.Class; |
| import org.eclipse.ocl.examples.pivot.Package; |
| import org.eclipse.ocl.examples.pivot.manager.PivotStandardLibrary; |
| import org.eclipse.ocl.examples.pivot.model.OCLstdlib; |
| import org.eclipse.ocl.examples.pivot.utilities.PivotUtil; |
| |
| /** |
| * This is the [uri/] Pivot Model of the Pivot Model |
| * auto-generated from [sourceFile/]. |
| * It facilitates efficient model loading without the overheads of model reading. |
| */ |
| @SuppressWarnings({"nls", "unused"}) |
| public class [javaClass/] extends XMIResourceImpl |
| { |
| /** |
| * The URI of this Standard Library. |
| */ |
| public static final String PIVOT_URI = "[uri/]"; |
| |
| public [javaClass/](PivotStandardLibrary standardLibrary, String name, String nsPrefix, String nsURI) { |
| super(URI.createURI(PIVOT_URI)); |
| Contents contents = new Contents(standardLibrary); |
| Package metaModel = contents.create(name != null ? name : "[pkg.name/]", nsPrefix != null ? nsPrefix : "[pkg.nsPrefix/]", nsURI != null ? nsURI : "[pkg.nsURI/]"); |
| getContents().add(metaModel); |
| } |
| |
| protected static class Contents extends AbstractContents |
| { |
| protected Contents(PivotStandardLibrary standardLibrary) { |
| super(standardLibrary); |
| } |
| |
| protected final PrimitiveType [pkg.ownedType->select(name='Boolean')->any(true).getPrefixedSymbolName('_Boolean')/] = standardLibrary.getBooleanType(); |
| protected final PrimitiveType [pkg.ownedType->select(name='Integer')->any(true).getPrefixedSymbolName('_Integer')/] = standardLibrary.getIntegerType(); |
| protected final Class [pkg.ownedType->select(name='OclElement')->any(true).getPrefixedSymbolName('_OclElement')/] = standardLibrary.getOclElementType(); |
| protected final PrimitiveType [pkg.ownedType->select(name='Real')->any(true).getPrefixedSymbolName('_Real')/] = standardLibrary.getRealType(); |
| protected final PrimitiveType [pkg.ownedType->select(name='String')->any(true).getPrefixedSymbolName('_String')/] = standardLibrary.getStringType(); |
| protected final PrimitiveType [pkg.ownedType->select(name='UnlimitedNatural')->any(true).getPrefixedSymbolName('_UnlimitedNatural')/] = standardLibrary.getUnlimitedNaturalType(); |
| |
| protected Package [pkg.getPrefixedSymbolName('metaModel')/]; |
| |
| protected Package create(String name, String nsPrefix, String nsURI) |
| { |
| [pkg.getSymbolName()/] = createPackage(name, nsPrefix, nsURI); |
| installPackages(); |
| installOclTypes(); |
| installPrimitiveTypes(); |
| [if (allEnumerations->notEmpty())] |
| installEnumerations(); |
| [/if] |
| installParameterTypes(); |
| installCollectionTypes(); |
| installClassifierTypes(); |
| [if (allLambdaTypes->notEmpty())] |
| installLambdaTypes(); |
| [/if] |
| [if (allTupleTypes->notEmpty())] |
| installTupleTypes(); |
| [/if] |
| installOperations(); |
| installIterations(); |
| installProperties(); |
| installTemplateSignatures(); |
| installTemplateBindings(); |
| installPrecedences(); |
| installComments(); |
| return [pkg.getSymbolName()/]; |
| } |
| |
| [pkg.definePackages()/] |
| [pkg.declareOclTypes()/] |
| [pkg.declarePrimitiveTypes()/] |
| [if (allEnumerations->notEmpty())] |
| [pkg.declareEnumerations()/] |
| [/if] |
| [pkg.declareParameterTypes()/] |
| [pkg.declareCollectionTypes()/] |
| [pkg.declareClassifierTypes()/] |
| [if (allTupleTypes->notEmpty())] |
| [pkg.declareTupleTypes()/] |
| [/if] |
| [pkg.defineOclTypes()/] |
| [pkg.definePrimitiveTypes()/] |
| [if (allEnumerations->notEmpty())] |
| [pkg.defineEnumerations()/] |
| [/if] |
| [pkg.defineParameterTypes()/] |
| [pkg.defineCollectionTypes()/] |
| [pkg.defineClassifierTypes()/] |
| [if (allTupleTypes->notEmpty())] |
| [pkg.defineTupleTypes()/] |
| [/if] |
| [if (allLambdaTypes->notEmpty())] |
| [pkg.defineLambdaTypes()/] |
| [/if] |
| [pkg.defineOperations()/] |
| [pkg.defineIterations()/] |
| [pkg.defineProperties()/] |
| [pkg.defineTemplateSignatures()/] |
| [pkg.defineTemplateBindings()/] |
| [pkg.definePrecedences()/] |
| [pkg.defineComments()/] |
| } |
| } |
| [/file] |
| [/let] |
| [/let] |
| [/let] |
| [/template] |