当前位置: 首页>>代码示例>>Java>>正文


Java EMFModel类代码示例

本文整理汇总了Java中org.eclipse.m2m.atl.core.emf.EMFModel的典型用法代码示例。如果您正苦于以下问题:Java EMFModel类的具体用法?Java EMFModel怎么用?Java EMFModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EMFModel类属于org.eclipse.m2m.atl.core.emf包,在下文中一共展示了EMFModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadTransformationModel

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
/**
	 * It loads a transformation as a model.
	 * @param atlTransformationFile 
	 * @return transformation model
	 * @throws ATLCoreException
	 */
	private EMFModel loadTransformationModel (String atlTransformationFile) throws ATLCoreException {
		ModelFactory      modelFactory = new EMFModelFactory();
		EMFReferenceModel atlMetamodel = (EMFReferenceModel)modelFactory.getBuiltInResource("ATL.ecore");
		AtlParser         atlParser    = new AtlParser();		
		EMFModel          atlModel     = (EMFModel)modelFactory.newModel(atlMetamodel);
		atlParser.inject (atlModel, atlTransformationFile);	
		atlModel.setIsTarget(true);				
		
//		// Should we want to serialize the model.
//		String injectedFile = "file:/" + atlTransformationFile + ".xmi";
//		IExtractor extractor = new EMFExtractor();
//		extractor.extract(atlModel, injectedFile);
		
		return atlModel;
	}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:22,代码来源:Tester.java

示例2: typing

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
public void typing(String atlTransformationFile, Object[] metamodels, String[] names) throws Exception {
	this.atlTransformationFile = atlTransformationFile;

	long diffs = 0;

	AtlParser atlParser = new AtlParser();
	ModelFactory modelFactory = new EMFModelFactory();
	IReferenceModel atlMetamodel = modelFactory
			.getBuiltInResource("ATL.ecore");
	EMFModel atlModel = (EMFModel) modelFactory.newModel(atlMetamodel);

	atlParser.inject(atlModel, atlTransformationFile);

	this.mm = loadMetamodels(metamodels, names);
	this.atlTransformation = new ATLModel(atlModel.getResource(), atlTransformationFile);
	this.analyser = new Analyser(mm, atlTransformation);

	long initTime = System.currentTimeMillis();
	analyser.perform();
	analysisData = new AnalysisResult(analyser);
	
	long finishTime = System.currentTimeMillis();
	diffs += (finishTime - initTime);
	// }
	System.out.println("Time: " + (diffs / 1000.0));
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:27,代码来源:BaseTest.java

示例3: loadAtlTransformation

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
private Resource loadAtlTransformation() {
	ModelFactory modelFactory = new EMFModelFactory();

	IReferenceModel atlMetamodel;
	try {
		atlMetamodel = modelFactory.getBuiltInResource("ATL.ecore");
		EMFModel loadedAtlModel = (EMFModel) modelFactory
				.newModel(atlMetamodel);

		AtlParser atlParser = new AtlParser();

		String srcFile = original.getTemplate();
		String anURI   = filePathResolver.resolveTransformation(component, srcFile);
				
		
		atlParser.inject(loadedAtlModel, anURI); 
				//filePathResolver.resolve(srcFile));

		loadedAtlModel.setIsTarget(true);
		return loadedAtlModel.getResource();
	} catch ( ATLCoreException e ) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:jesusc,项目名称:bento,代码行数:25,代码来源:AtlMemoryTemplate.java

示例4: generateMutants

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
@Override
public void generateMutants(EMFModel atlModel, MetaModel inputMM, MetaModel outputMM, String outputFolder) {
	this.genericAttributeModification(atlModel, outputFolder, BooleanExp.class, "booleanSymbol", outputMM);
	this.genericAttributeModification(atlModel, outputFolder, StringExp.class,  "stringSymbol",  outputMM);
	this.genericAttributeModification(atlModel, outputFolder, IntegerExp.class, "integerSymbol", outputMM);
	this.genericAttributeModification(atlModel, outputFolder, RealExp.class,    "realSymbol",    outputMM);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:8,代码来源:PrimitiveValueModificationMutator.java

示例5: generateMutants

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
@Override
public void generateMutants(EMFModel atlModel, MetaModel inputMM, MetaModel outputMM, String outputFolder) {
	// initialize list of helpers in the transformation
	helpers_by_return  = new Hashtable<String, List<String>>();
	helpers_by_context = new Hashtable<String, List<String>>();
	
	// obtain helper definitions in transformation (both attribute and operation helpers)
	ATLModel     wrapper = new ATLModel(atlModel.getResource());
	List<Helper> helpers = (List<Helper>)wrapper.allObjectsOf(Helper.class);
	for (Helper helper : helpers) {
		if (helper.getDefinition()!=null &&
			helper.getDefinition().getContext_()!=null &&
			helper.getDefinition().getContext_().getContext_()!=null &&
			(helper.getDefinition().getFeature() instanceof Operation || helper.getDefinition().getFeature() instanceof Attribute)) {
			String helper_context = helper.getDefinition().getContext_().getContext_().getName();
			String helper_return  = helper.getDefinition().getFeature() instanceof Operation? 
					                toString(((Operation)helper.getDefinition().getFeature()).getReturnType()):
			                        toString(((Attribute)helper.getDefinition().getFeature()).getType());
			String helper_name    = helper.getDefinition().getFeature() instanceof Operation?
					                ((Operation)helper.getDefinition().getFeature()).getName():
			                        ((Attribute)helper.getDefinition().getFeature()).getName();
			if (!helpers_by_return. containsKey(helper_return )) helpers_by_return. put(helper_return,  new ArrayList<String>());
			if (!helpers_by_context.containsKey(helper_context)) helpers_by_context.put(helper_context, new ArrayList<String>());
			helpers_by_return. get(helper_return ).add(helper_name);
			helpers_by_context.get(helper_context).add(helper_name);
		}
	}
	
	// generate mutants
	this.genericAttributeModification(atlModel, outputFolder, OperationCallExp.class, "operationName", outputMM, true);
	this.genericAttributeModification(atlModel, outputFolder, NavigationOrAttributeCallExp.class, "name", outputMM, true);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:33,代码来源:HelperOperationModificationMutator.java

示例6: generateMutants

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
@Override
public void generateMutants(EMFModel atlModel, MetaModel inputMM, MetaModel outputMM, String outputFolder) {
	// deletion of parameters in helpers
	this.genericDeletion(atlModel, outputFolder, Operation.class, Parameter.class, "parameters");
	// deletion of parameters in called rules
	this.genericDeletion(atlModel, outputFolder, CalledRule.class, Parameter.class, "parameters");
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:8,代码来源:ParameterDeletionMutator.java

示例7: createATLModel

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
@Override
protected ATLModel createATLModel(IFile file, EMFModel atlEMFModel) {
	getCreateATLModelTimeRecorder().start("CREATE_ATL_MODEL");
	ATLModel r = super.createATLModel(file, atlEMFModel);
	getCreateATLModelTimeRecorder().stop();
	return r;
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:8,代码来源:MeasurePerformance.java

示例8: executeAnalyser

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
protected AnalyserData executeAnalyser(IResource resource)
		throws IOException, CoreException, CannotLoadMetamodel, PreconditionParseError {
	IFile file = (IFile) resource;
	EMFModel atlEMFModel = parseATLFile(file);
	ATLModel  atlModel = createATLModel(file, atlEMFModel);
	if ( !( atlModel.getRoot() instanceof Module) ) {
		return null; 
	}

	return executeAnalyser(resource, atlModel);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:12,代码来源:AbstractATLExperiment.java

示例9: exec

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
public TranslationResult exec(String oclExpr) {
	String aQuery = "query dummy = \n" + oclExpr + ";";

	EMFModel libModel = AtlEngineUtils.loadATLText(aQuery);
	if ( libModel.getResource().getErrors().size() > 0 ) {
		System.out.println(libModel.getResource().getErrors());
		return TranslationResult.error(libModel.getResource().getErrors().stream().map(o -> o.toString()).collect(Collectors.toList()));
	}
	ATLModel model = new ATLModel(libModel.getResource());
	Query q = (Query) model.getRoot();
	return new TranslationResult(q.getBody());
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:13,代码来源:OCLinATL.java

示例10: load

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
public static Resource load(String fname) throws ATLCoreException {
	AtlParser atlParser = new AtlParser();
	ModelFactory modelFactory = new EMFModelFactory();
	IReferenceModel atlMetamodel = modelFactory.getBuiltInResource("ATL.ecore");
	EMFModel atlDynModel = (EMFModel) modelFactory.newModel(atlMetamodel);
	atlParser.inject(atlDynModel, fname);
	
	
	Resource originalTrafo = atlDynModel.getResource();
	return originalTrafo;
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:12,代码来源:AtlLoader.java

示例11: exec

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
public AnalyserData exec(InputStream stream) throws IOException, CoreException, CannotLoadMetamodel, PreconditionParseError  {
	EMFModel atlEMFModel = AtlEngineUtils.loadATLFile(null, stream, false);
	if ( atlEMFModel == null )
		return null;
			
	ATLModel  atlModel = new ATLModel(atlEMFModel.getResource(), null);
	return exec(null, atlModel, false);
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:9,代码来源:AnalyserExecutor.java

示例12: loadATLFile

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
public static EMFModel loadATLFile(IFile file, boolean withProblems) {
	try {
		return loadATLFile(file, file.getContents(), withProblems);
	} catch (CoreException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:9,代码来源:AtlEngineUtils.java

示例13: getOutputModel

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
public RootMeasureSet getOutputModel() {
	// To have a common root object...
	RootMeasureSet rms = (RootMeasureSet) ((EMFModel) this.outModel).getResource().getContents().get(0);
	MeasureSet ms = (MeasureSet) ((EMFModel) this.outModel).getResource().getContents().get(1);
	rms.getMeasureSets().add(ms);
	
	return  rms;
}
 
开发者ID:jesusc,项目名称:bento,代码行数:9,代码来源:MyEcore2Measure.java

示例14: fillMetamodelTable

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
private void fillMetamodelTable(IFile file) {
	if ( ! atlTransformation.getMetamodels().isEmpty() ) 
		return;
		
	EMFModel model = AtlEngineUtils.loadATLFile(file);
	ATLModel atlModel = new ATLModel(model.getResource());				
	if ( model != null ) {			
		for(ModelInfo m : ATLUtils.getModelInfo(atlModel)) {
			Metamodel mm = RevengFactory.eINSTANCE.createMetamodel();
			mm.setName(m.getMetamodelName());
			mm.setModelName(m.getModelName());
			
			if ( m.hasMetamodelInfo() ) {
				mm.setPath(m.getURIorPath());
			}
			
			if ( m.isInput() ) {
				mm.setBecomeConcept(true);
			}
			
			this.atlTransformation.getMetamodels().add(mm);
		}
		markAsDirty();
		listMetamodels.refresh();				
	}		

}
 
开发者ID:jesusc,项目名称:bento,代码行数:28,代码来源:TransformationConfigurationPage.java

示例15: generateMutants

import org.eclipse.m2m.atl.core.emf.EMFModel; //导入依赖的package包/类
@Override
public void generateMutants(EMFModel atlModel, MetaModel inputMM, MetaModel outputMM, String outputFolder) {
	
	ATLModel          wrapper   = new ATLModel(atlModel.getResource());
	List<VariableExp> variables = (List<VariableExp>)wrapper.allObjectsOf(VariableExp.class);
	
	// we will add a comment to the module, documenting the mutation 
	Module module = wrapper.getModule();
	EDataTypeEList<String> comments = null;
	if (module!=null) {
		EStructuralFeature f = wrapper.source(module).eClass().getEStructuralFeature("commentsBefore");	
		comments = (EDataTypeEList<String>)wrapper.source(module).eGet(f);
	}
	
	// navigate navigation expressions starting from each variable
	for (VariableExp variable : variables) {
		
		EObject navigationExpression = variable.eContainer();
		while  (navigationExpression != null) {

			if (navigationExpression instanceof NavigationOrAttributeCallExp) {

				EStructuralFeature featureDefinition = wrapper.source(navigationExpression).eClass().getEStructuralFeature("name");

				// obtain list of replacements
				String type       = getType(navigationExpression, variable, inputMM, outputMM); 
				String navigation = ((NavigationOrAttributeCallExp)navigationExpression).getName();
				List<Object> replacements = this.featureReplacements(type, navigation, inputMM);

				for (Object replacement : replacements) {
					wrapper.source(navigationExpression).eSet(featureDefinition, replacement);

					// mutation: documentation
					if (comments!=null) comments.add("\n-- MUTATION \"" + this.getDescription() + "\" from " + toString(navigationExpression, variable) + navigation + " to " + toString(navigationExpression, variable) + replacement  + " (line " + ((LocatedElement)navigationExpression).getLocation() + " of original transformation)\n");

					// save mutant
					this.save(atlModel, outputFolder);

					// remove comment
					if (comments!=null) comments.remove(comments.size()-1);
				}

				// restore original value
				wrapper.source(navigationExpression).eSet(featureDefinition, navigation);					
			}
			
			// continue navigation in current expression (e.g. object.feature1.feature2)
			if (navigationExpression instanceof NavigationOrAttributeCallExp && navigationExpression.eContainer() instanceof NavigationOrAttributeCallExp) {
				navigationExpression = navigationExpression.eContainer();
			}
			else navigationExpression = null;
		}
	}
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:55,代码来源:NavigationModificationMutator.java


注:本文中的org.eclipse.m2m.atl.core.emf.EMFModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。