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


Java EFactory.create方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.EFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Java EFactory.create方法的具体用法?Java EFactory.create怎么用?Java EFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.EFactory的用法示例。


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

示例1: createLayoutInformationModelElement

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public EObject createLayoutInformationModelElement(eu.hyvar.feature.expression.resource.hyexpression.mopp.HyexpressionLayoutInformation layoutInformation, EPackage layoutPackage) {
	EFactory factory = layoutPackage.getEFactoryInstance();
	Object object = layoutInformation.getObject(null, false);
	eu.hyvar.feature.expression.resource.hyexpression.grammar.HyexpressionSyntaxElement syntaxElement = layoutInformation.getSyntaxElement();
	EClass layoutInformationEClass = null;
	EObject layoutInformationModelElement = null;
	if (object == null) {
		// keyword
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(KEYWORD_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	} else if (object instanceof EObject) {
		// reference
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(REFERENCE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
		layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(OBJECT_EATTRIBUTE_NAME), object);
	} else {
		// attribute
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(ATTRIBUTE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	}
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(START_OFFSET_EATTRIBUTE_NAME), layoutInformation.getStartOffset());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(HIDDEN_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getHiddenTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(VISIBLE_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getVisibleTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(SYNTAX_ELEMENT_ID_EATTRIBUTE_NAME), eu.hyvar.feature.expression.resource.hyexpression.grammar.HyexpressionGrammarInformationProvider.getSyntaxElementID(syntaxElement));
	return layoutInformationModelElement;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:27,代码来源:HyexpressionLayoutUtil.java

示例2: createLayoutInformationModelElement

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public EObject createLayoutInformationModelElement(eu.hyvar.mspl.manifest.resource.hymanifest.mopp.HymanifestLayoutInformation layoutInformation, EPackage layoutPackage) {
	EFactory factory = layoutPackage.getEFactoryInstance();
	Object object = layoutInformation.getObject(null, false);
	eu.hyvar.mspl.manifest.resource.hymanifest.grammar.HymanifestSyntaxElement syntaxElement = layoutInformation.getSyntaxElement();
	EClass layoutInformationEClass = null;
	EObject layoutInformationModelElement = null;
	if (object == null) {
		// keyword
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(KEYWORD_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	} else if (object instanceof EObject) {
		// reference
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(REFERENCE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
		layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(OBJECT_EATTRIBUTE_NAME), object);
	} else {
		// attribute
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(ATTRIBUTE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	}
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(START_OFFSET_EATTRIBUTE_NAME), layoutInformation.getStartOffset());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(HIDDEN_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getHiddenTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(VISIBLE_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getVisibleTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(SYNTAX_ELEMENT_ID_EATTRIBUTE_NAME), eu.hyvar.mspl.manifest.resource.hymanifest.grammar.HymanifestGrammarInformationProvider.getSyntaxElementID(syntaxElement));
	return layoutInformationModelElement;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:27,代码来源:HymanifestLayoutUtil.java

示例3: createLayoutInformationModelElement

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public EObject createLayoutInformationModelElement(eu.hyvar.feature.mapping.resource.hymapping.mopp.HymappingLayoutInformation layoutInformation, EPackage layoutPackage) {
	EFactory factory = layoutPackage.getEFactoryInstance();
	Object object = layoutInformation.getObject(null, false);
	eu.hyvar.feature.mapping.resource.hymapping.grammar.HymappingSyntaxElement syntaxElement = layoutInformation.getSyntaxElement();
	EClass layoutInformationEClass = null;
	EObject layoutInformationModelElement = null;
	if (object == null) {
		// keyword
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(KEYWORD_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	} else if (object instanceof EObject) {
		// reference
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(REFERENCE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
		layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(OBJECT_EATTRIBUTE_NAME), object);
	} else {
		// attribute
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(ATTRIBUTE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	}
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(START_OFFSET_EATTRIBUTE_NAME), layoutInformation.getStartOffset());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(HIDDEN_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getHiddenTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(VISIBLE_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getVisibleTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(SYNTAX_ELEMENT_ID_EATTRIBUTE_NAME), eu.hyvar.feature.mapping.resource.hymapping.grammar.HymappingGrammarInformationProvider.getSyntaxElementID(syntaxElement));
	return layoutInformationModelElement;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:27,代码来源:HymappingLayoutUtil.java

示例4: createLayoutInformationModelElement

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public EObject createLayoutInformationModelElement(eu.hyvar.feature.constraint.resource.hyconstraints.mopp.HyconstraintsLayoutInformation layoutInformation, EPackage layoutPackage) {
	EFactory factory = layoutPackage.getEFactoryInstance();
	Object object = layoutInformation.getObject(null, false);
	eu.hyvar.feature.constraint.resource.hyconstraints.grammar.HyconstraintsSyntaxElement syntaxElement = layoutInformation.getSyntaxElement();
	EClass layoutInformationEClass = null;
	EObject layoutInformationModelElement = null;
	if (object == null) {
		// keyword
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(KEYWORD_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	} else if (object instanceof EObject) {
		// reference
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(REFERENCE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
		layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(OBJECT_EATTRIBUTE_NAME), object);
	} else {
		// attribute
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(ATTRIBUTE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	}
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(START_OFFSET_EATTRIBUTE_NAME), layoutInformation.getStartOffset());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(HIDDEN_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getHiddenTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(VISIBLE_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getVisibleTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(SYNTAX_ELEMENT_ID_EATTRIBUTE_NAME), eu.hyvar.feature.constraint.resource.hyconstraints.grammar.HyconstraintsGrammarInformationProvider.getSyntaxElementID(syntaxElement));
	return layoutInformationModelElement;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:27,代码来源:HyconstraintsLayoutUtil.java

示例5: createLayoutInformationModelElement

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public EObject createLayoutInformationModelElement(eu.hyvar.context.contextValidity.resource.hyvalidityformula.mopp.HyvalidityformulaLayoutInformation layoutInformation, EPackage layoutPackage) {
	EFactory factory = layoutPackage.getEFactoryInstance();
	Object object = layoutInformation.getObject(null, false);
	eu.hyvar.context.contextValidity.resource.hyvalidityformula.grammar.HyvalidityformulaSyntaxElement syntaxElement = layoutInformation.getSyntaxElement();
	EClass layoutInformationEClass = null;
	EObject layoutInformationModelElement = null;
	if (object == null) {
		// keyword
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(KEYWORD_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	} else if (object instanceof EObject) {
		// reference
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(REFERENCE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
		layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(OBJECT_EATTRIBUTE_NAME), object);
	} else {
		// attribute
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(ATTRIBUTE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	}
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(START_OFFSET_EATTRIBUTE_NAME), layoutInformation.getStartOffset());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(HIDDEN_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getHiddenTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(VISIBLE_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getVisibleTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(SYNTAX_ELEMENT_ID_EATTRIBUTE_NAME), eu.hyvar.context.contextValidity.resource.hyvalidityformula.grammar.HyvalidityformulaGrammarInformationProvider.getSyntaxElementID(syntaxElement));
	return layoutInformationModelElement;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:27,代码来源:HyvalidityformulaLayoutUtil.java

示例6: createLayoutInformationModelElement

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public EObject createLayoutInformationModelElement(eu.hyvar.dataValues.resource.hydatavalue.mopp.HydatavalueLayoutInformation layoutInformation, EPackage layoutPackage) {
	EFactory factory = layoutPackage.getEFactoryInstance();
	Object object = layoutInformation.getObject(null, false);
	eu.hyvar.dataValues.resource.hydatavalue.grammar.HydatavalueSyntaxElement syntaxElement = layoutInformation.getSyntaxElement();
	EClass layoutInformationEClass = null;
	EObject layoutInformationModelElement = null;
	if (object == null) {
		// keyword
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(KEYWORD_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	} else if (object instanceof EObject) {
		// reference
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(REFERENCE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
		layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(OBJECT_EATTRIBUTE_NAME), object);
	} else {
		// attribute
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(ATTRIBUTE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	}
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(START_OFFSET_EATTRIBUTE_NAME), layoutInformation.getStartOffset());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(HIDDEN_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getHiddenTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(VISIBLE_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getVisibleTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(SYNTAX_ELEMENT_ID_EATTRIBUTE_NAME), eu.hyvar.dataValues.resource.hydatavalue.grammar.HydatavalueGrammarInformationProvider.getSyntaxElementID(syntaxElement));
	return layoutInformationModelElement;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:27,代码来源:HydatavalueLayoutUtil.java

示例7: createLayoutInformationModelElement

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public EObject createLayoutInformationModelElement(de.darwinspl.preferences.resource.dwprofile.mopp.DwprofileLayoutInformation layoutInformation, EPackage layoutPackage) {
	EFactory factory = layoutPackage.getEFactoryInstance();
	Object object = layoutInformation.getObject(null, false);
	de.darwinspl.preferences.resource.dwprofile.grammar.DwprofileSyntaxElement syntaxElement = layoutInformation.getSyntaxElement();
	EClass layoutInformationEClass = null;
	EObject layoutInformationModelElement = null;
	if (object == null) {
		// keyword
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(KEYWORD_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	} else if (object instanceof EObject) {
		// reference
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(REFERENCE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
		layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(OBJECT_EATTRIBUTE_NAME), object);
	} else {
		// attribute
		layoutInformationEClass = (EClass) layoutPackage.getEClassifier(ATTRIBUTE_LAYOUT_INFORMATION_ECLASS_NAME);
		layoutInformationModelElement = factory.create(layoutInformationEClass);
	}
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(START_OFFSET_EATTRIBUTE_NAME), layoutInformation.getStartOffset());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(HIDDEN_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getHiddenTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(VISIBLE_TOKEN_TEXT_EATTRIBUTE_NAME), layoutInformation.getVisibleTokenText());
	layoutInformationModelElement.eSet(layoutInformationEClass.getEStructuralFeature(SYNTAX_ELEMENT_ID_EATTRIBUTE_NAME), de.darwinspl.preferences.resource.dwprofile.grammar.DwprofileGrammarInformationProvider.getSyntaxElementID(syntaxElement));
	return layoutInformationModelElement;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:27,代码来源:DwprofileLayoutUtil.java

示例8: testFillIdToEObjectMap

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
@Test
public void testFillIdToEObjectMap() {
	EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
	EClass root = createEClass(pack, "Root");
	EClass someType = createEClass(pack, "SomeType");

	EReference ref1 = addEReference(root, someType, "ref1", false);
	EReference ref2 = addEReference(root, someType, "ref2", true);

	EFactory factory = pack.getEFactoryInstance();
	EObject rootObject = factory.create(root);
	EObject someTypeObject1 = factory.create(someType);
	EObject someTypeObject2 = factory.create(someType);
	rootObject.eSet(ref1, someTypeObject1);
	rootObject.eSet(ref2, someTypeObject2);

	List<EObject> map = new ArrayList<>();
	SerializationUtil.fillIdToEObjectMap(rootObject, map);
	assertTrue(map.contains(rootObject));
	assertTrue(map.contains(someTypeObject1));
	assertFalse(map.contains(someTypeObject2));
	assertEquals(2, map.size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:24,代码来源:SerializationUtilTest.java

示例9: init

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
@Before
public void init() {
  EcoreFactory modelFactory = EcoreFactory.eINSTANCE;
  testModelPackage = modelFactory.createEPackage();
  testModelPackage.setName("TypeProviderTestEPackage");
  testModelPackage.setNsPrefix("typeprovidertestpackage");
  testModelPackage.setNsURI("http://testabstracttype");
  EFactory instanceFactory = testModelPackage.getEFactoryInstance();
  EClass clazz = createEClass("ExpressionContainer");
  expressionContainerReference = modelFactory.createEReference();
  clazz.getEStructuralFeatures().add(expressionContainerReference);
  expressionContainerReference.setName("expression");
  expressionContainerReference.setEType(typeModelPackage.getIExpression());
  expressionContainerReference.setContainment(true);
  expression1Container = instanceFactory.create(clazz);
  expression1Container.eSet(expressionContainerReference, expression1);
  expression2Container = instanceFactory.create(clazz);
  expression2Container.eSet(expressionContainerReference, expression2);
  expression3Container = instanceFactory.create(clazz);
  expression3Container.eSet(expressionContainerReference, expression3);
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:22,代码来源:AbstractTypeProviderTest.java

示例10: testJSFormulaEngine

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public void testJSFormulaEngine() throws Exception {
	AD.load(URI.createPlatformPluginURI("/gov.nasa.ensemble.core.plan.formula.js/datafiles/TestJSFormulaEngine.dictionary", true));

	EActivityDef referencingActivityDef = AD.getActivityDef("ReferencingActivity");
	assertNotNull(referencingActivityDef);
	
	EStructuralFeature crewMemberFeature = referencingActivityDef.getEStructuralFeature("crewMember");
	assertNotNull(crewMemberFeature);

	EClass crewMemberDef = (EClass) AD.getEClassifier("CrewMember");
	assertNotNull(crewMemberDef);
	
	EStructuralFeature busyFeature = crewMemberDef.getEStructuralFeature("busy");
	assertNotNull(busyFeature);
	
	EFactory factory = crewMemberDef.getEPackage().getEFactoryInstance();
	EObject crewMember = factory.create(crewMemberDef);
	
	EActivity referencingActivity = PlanFactory.getInstance().createActivity(referencingActivityDef);
	referencingActivity.getData().eSet(crewMemberFeature, crewMember);
	
	assertReferenceValue(referencingActivity, crewMember, busyFeature, 0);

	crewMember.eSet(busyFeature, 1);
	assertReferenceValue(referencingActivity, crewMember, busyFeature, 1);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:27,代码来源:TestJSFormulaEngine.java

示例11: createResourceSet

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
private ResourceSet createResourceSet() {
	
	EFactory factory = AD.getEFactoryInstance();
	ResourceSet resourceSet = sharedResourceSet;
	Resource resourceAsInAFile = resourceSet.createResource(URI.createURI("http://junit/foo.resource"));
	
	ObjectDef referenceDefinition = AD.getDefinitions(ObjectDef.class).get(0);

	EStructuralFeature idFeature = getEStructuralFeature(referenceDefinition, "id");
	EStructuralFeature nameFeature = getEStructuralFeature(referenceDefinition, "name");

	{ int id = 0;
	  for (char digitChar : referenceNames) {
		  String name = String.valueOf(digitChar);
		  EObject referenceInstance = factory.create(referenceDefinition);
		  referenceInstance.eSet(idFeature, "Resource id#" + id++);
		  referenceInstance.eSet(nameFeature, name);
		  resourceAsInAFile.getContents().add(referenceInstance);
		  referenceNameToObject.put(name, referenceInstance);
	  }
	}
	return resourceSet;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:24,代码来源:ResourcefulPlanForPlanDiffTest.java

示例12: evaluateEClassQuery

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public void evaluateEClassQuery(String kQuery, OCLReasoningEngine oclReasoner, EObject kRootModelObj, EClass kModelElemTypeClass, EFactory kModelTypeFactory, Map<String, Map<EObject, EObject>> queryUnion) {

		for (String kQueryRow : kQuery.split(ROW_SEPARATOR)) {
			String[] kQueryAssignment = kQueryRow.split(UNION_ASSIGNMENT);
			String oclQuery = kQueryAssignment[1].trim();
			String unionName = kQueryAssignment[0].substring(kQueryAssignment[0].indexOf(UNION_KEYWORD)+UNION_KEYWORD.length(), kQueryAssignment[0].length()).trim();
			Map<EObject, EObject> queryRow = new LinkedHashMap<EObject, EObject>();
			queryUnion.put(unionName, queryRow);
			Object queryObjs = oclReasoner.evaluateQuery(kRootModelObj, oclQuery);
			if (!(queryObjs instanceof Collection<?>)) {
				continue;
			}
			for (Object queryObj : (Collection<?>) queryObjs) {
				EObject modelObj = (EObject) queryObj;
				EObject kModelObj = kModelTypeFactory.create(kModelElemTypeClass);
				for (EStructuralFeature feature : modelObj.eClass().getEAllStructuralFeatures()) { // copy shared non-containment features
					EStructuralFeature kFeature = kModelObj.eClass().getEStructuralFeature(feature.getName());
					if ((feature instanceof EReference && ((EReference) feature).isContainment()) || kFeature == null) {
						continue;
					}
					kModelObj.eSet(kFeature, modelObj.eGet(feature));
				}
				queryRow.put(modelObj, kModelObj);
			}
		}
	}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:27,代码来源:KleisliReasoningEngine.java

示例13: createEntity

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
/**
 * Create an entity of a given kind.
 * 
 * @param kind
 *            The kind of the entity to create.
 * @return The created entity, else null.
 */
public static Entity createEntity(Kind kind) {
	Entity createdEntity = null;

	// Get the name space of the Ecore package for this kind.
	String epackageNS = Occi2Ecore.convertOcciScheme2EcoreNamespace(kind.getScheme());
	// Get the Ecore package associated to the kind.
	EPackage epackage = EPackage.Registry.INSTANCE.getEPackage(epackageNS);
	if (epackage == null) {
		LOGGER.warn("EPackage " + epackageNS + " not found!");
	} else {
		String classname = Occi2Ecore.convertOcciCategoryTerm2EcoreClassName(kind.getTerm());
		// Get the Ecore class associated to the kind.
		EClass eclass = (EClass) epackage.getEClassifier(classname);
		if (eclass == null) {
			LOGGER.warn("EClass " + classname + " not found!");
		} else {
			// Get the Ecore factory associated to the kind.
			EFactory efactory = EPackage.Registry.INSTANCE.getEFactory(epackageNS);
			if (efactory == null) {
				LOGGER.warn("EFactory " + epackageNS + " not found!");
			} else {
				// Create the EObject for this kind.
				createdEntity = (Entity) efactory.create(eclass);
			}
		}
	}
	if (createdEntity == null) {
		LOGGER.warn("Create OCCI Core Resource!");
		createdEntity = OCCIFactory.eINSTANCE.createResource();
		createdEntity.setKind(kind);
	}

	LOGGER.debug("created entity=" + createdEntity);
	// Return the new entity.
	return createdEntity;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:44,代码来源:OcciHelper.java

示例14: createInstance

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public EObject createInstance(final EClass eClass) {
	final String nsURI = eClass.getEPackage().getNsURI();
	final EFactory factory = packageRegistry.getEFactory(nsURI);
	if (factory == null) {
		throw new NoSuchElementException(String.format("Could not find the EFactory for nsURI '%s' in the resource set's package registry", nsURI));
	}

	final EObject obj = factory.create(eClass);
	return createLazyLoadingInstance(eClass, obj.getClass());
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:11,代码来源:LazyEObjectFactory.java

示例15: addRow

import org.eclipse.emf.ecore.EFactory; //导入方法依赖的package包/类
public void addRow() {
	if (currentInput == null) {
		return;
	}
	int index = tabFolder.getSelectionIndex();
	EClass eClass = getEClassForSelectionIndex(index);
	if (eClass != null) {
		EFactory factory = eClass.getEPackage().getEFactoryInstance();
		EObject eObject = factory.create(eClass);
		Object feature = getEReferenceForSelectionIndex(index);
		EditingDomain domain = planEditorModel.getEditingDomain();
		Command command = AddCommand.create(domain, currentInput, feature, Collections.singleton(eObject));
		EMFUtils.executeCommand(domain, command);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:16,代码来源:ProfileEffectsAndRequirementsPage.java


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