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


Java Copier.containsKey方法代码示例

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


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

示例1: updateEObjectsAltered

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsAltered() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	if (!copier.containsKey(altered[0])) {
		copier.copy((EObject)altered[0]);
	}
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = copier.get(altered[0]);
	final EStructuralFeature expectedFeature = (EStructuralFeature)altered[1];
	final Object expectedValue;
	if (altered[2] instanceof EObject) {
		expectedValue = copier.get(altered[2]);
	} else {
		expectedValue = altered[2];
	}

	List<EObject> newEObjects = testEObjects;
	newEObjects = alterEObjects(copier, newEObjects);

	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:43,代码来源:EObjectConnectorParametrizedTests.java

示例2: updateEObjectsPlusShiftAltered

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsPlusShiftAltered() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	if (!copier.containsKey(altered[0])) {
		copier.copy((EObject)altered[0]);
	}
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = copier.get(altered[0]);
	final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
	final Object expectedValue;
	if (altered[2] instanceof EObject) {
		expectedValue = copier.get(altered[2]);
	} else {
		expectedValue = altered[2];
	}

	List<EObject> newEObjects = new ArrayList<EObject>(MappingPackage.eINSTANCE.getEClassifiers());
	newEObjects.addAll(testEObjects);
	newEObjects = alterEObjects(copier, newEObjects);

	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:44,代码来源:EObjectConnectorParametrizedTests.java

示例3: updateEObjectsMinusShiftAltered

import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsMinusShiftAltered() throws Exception {
	final IBase base = new BaseRegistryTests.TestBase();
	base.getFactory().addDescriptor(IEObjectLocation.class,
			new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
	base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
			TestCouple.class));
	final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
	container.setContainer(base);
	final Copier copier = new Copier();
	EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
	if (!copier.containsKey(altered[0])) {
		copier.copy((EObject)altered[0]);
	}
	copier.copyReferences();
	final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
	final Resource initialResource = createResource("initialResource");
	container.setResource(initialResource);
	initialResource.getContents().addAll(testEObjects);
	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
	final IEObjectLocation location = createEObjectLocation(copier, container);

	final EObject expectedEObject = copier.get(altered[0]);
	final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
	final Object expectedValue;
	if (altered[2] instanceof EObject) {
		expectedValue = copier.get(altered[2]);
	} else {
		expectedValue = altered[2];
	}

	List<EObject> newEObjects = new ArrayList<EObject>(testEObjects);
	newEObjects.remove(0);
	newEObjects.remove(0);
	newEObjects = alterEObjects(copier, newEObjects);

	final Resource newResource = createResource("newResource");
	newResource.getContents().addAll(newEObjects);

	eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
	container.setResource(newResource);

	assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:45,代码来源:EObjectConnectorParametrizedTests.java


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