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


Java EFactory类代码示例

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


EFactory类属于org.eclipse.emf.ecore包,在下文中一共展示了EFactory类的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: setFromSlot

import org.eclipse.emf.ecore.EFactory; //导入依赖的package包/类
public static Object setFromSlot(final EFactory eFactory, final EClass eClass, final EObject eObject, final AttributeSlot slot) throws IOException {
	final EStructuralFeature feature = eClass.getEStructuralFeature(slot.name);
	if (feature == null) {
		return null;
	}
	if (!feature.isChangeable() || feature.isDerived() && !(eObject instanceof DynamicEStoreEObjectImpl)) {
		return null;
	}
	if (!slot.isSetValue()) {
		return null;
	}

	// isSet=true and many=false means that we should have exactly one value
	final EClassifier eType = feature.getEType();
	if (eType.eContainer() == EcorePackage.eINSTANCE) {
		return fromEcoreType(eClass, eObject, slot, feature, eType);
	} else if (eType instanceof EEnum) {
		return fromEnum(eFactory, eClass, eObject, slot, feature, (EEnum)eType);
	} else {
		return fromInstanceClass(eClass, eObject, slot, feature, eType);
	}
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:23,代码来源:SlotDecodingUtils.java

示例11: fromEnum

import org.eclipse.emf.ecore.EFactory; //导入依赖的package包/类
private static Object fromEnum(final EFactory eFactory, final EClass eClass,
		final EObject eObject, final AttributeSlot slot,
		final EStructuralFeature feature, final EEnum enumType)
		throws IOException {
	if (!slot.value.isSetVStrings() && !slot.value.isSetVString()) {
		throw new IOException(
			String.format(
				"Expected to receive strings for feature '%s' in type '%s' with many='%s', but did not",
				feature.getName(), eClass.getName(), feature.isMany()));
	} else if (feature.isMany()) {
		final List<Object> literals = new ArrayList<>();
		if (slot.value.isSetVStrings()) {
			for (final String s : slot.value.getVStrings()) {
				literals.add(eFactory.createFromString(enumType, s));
			}
		} else {
			literals.add(eFactory.createFromString(enumType, slot.value.getVString()));
		}
		eObject.eSet(feature, literals);
		return literals;
	} else {
		final Object enumLiteral = eFactory.createFromString(enumType, slot.value.getVString());
		eObject.eSet(feature, enumLiteral);
		return enumLiteral;
	}
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:27,代码来源:SlotDecodingUtils.java

示例12: fetchAttributes

import org.eclipse.emf.ecore.EFactory; //导入依赖的package包/类
public void fetchAttributes(final Map<String, EObject> objects) throws IOException, HawkInstanceNotFound, HawkInstanceNotRunning, TException {
	final HawkQueryOptions options = new HawkQueryOptions();
	options.setIncludeAttributes(true);
	options.setIncludeReferences(false);
	setEffectiveMetamodelOptions(options, descriptor.getEffectiveMetamodel());

	final List<ModelElement> elems = client.resolveProxies(
		descriptor.getHawkInstance(), new ArrayList<>(objects.keySet()),
		options);

	for (ModelElement me : elems) {
		final EObject object = objects.get(me.id);
		final EFactory eFactory = getResourceSet().getPackageRegistry().getEFactory(me.getMetamodelUri());
		final EClass eClass = getEClass(
				me.getMetamodelUri(), me.getTypeName(),
				getResourceSet().getPackageRegistry());
		for (final AttributeSlot s : me.attributes) {
			SlotDecodingUtils.setFromSlot(eFactory, eClass, object, s);
		}
	}
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:22,代码来源:HawkResourceImpl.java

示例13: setScalarAttribute

import org.eclipse.emf.ecore.EFactory; //导入依赖的package包/类
private static Object setScalarAttribute(final EFactory eFactory, final EObject eObject, final Object value,
		final EStructuralFeature feature) {
	final Object singleValue = normalizeIntoScalar(value);
	if (singleValue == null) {
		eObject.eUnset(feature);
		return null;
	}

	final EClassifier eType = feature.getEType();
	if (eType instanceof EEnum) {
		final EEnum enumType = (EEnum)eType;
		final Object literal = eFactory.createFromString(enumType, singleValue.toString());
		eObject.eSet(feature, literal);
		return literal;
	} else {
		eObject.eSet(feature, singleValue);
		return singleValue;
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:20,代码来源:AttributeUtils.java

示例14: setListAttribute

import org.eclipse.emf.ecore.EFactory; //导入依赖的package包/类
private static Object setListAttribute(final EFactory eFactory, final EObject eObject, final Object value,
		final EStructuralFeature feature) {
	final EList<Object> manyValue = normalizeIntoList(value);
	if (manyValue == null) {
		eObject.eUnset(feature);
		return null;
	}

	final EClassifier eType = feature.getEType();
	if (eType instanceof EEnum) {
		final EEnum enumType = (EEnum)eType;
		final EList<Object> literals = new BasicEList<>();
		for (final Object o : manyValue) {
			literals.add(eFactory.createFromString(enumType, o.toString()));
		}
		eObject.eSet(feature, literals);
		return literals;
	} else {
		eObject.eSet(feature, manyValue);
		return manyValue;
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:23,代码来源:AttributeUtils.java

示例15: 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


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