當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。