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