Java Code Examples for org.eclipse.emf.ecore.EObject#eSet()

The following examples show how to use org.eclipse.emf.ecore.EObject#eSet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceLifecycleManager.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
public Resource openAndApplyReferences(ResourceSet resourceSet, RelatedResource toLoad) {
	Resource resource = resourceSet.getResource(toLoad.getUri(), true);
	for (IReferenceSnapshot desc : toLoad.outgoingReferences) {
		EObject source = resource.getEObject(desc.getSourceEObjectUri().fragment());
		EObject target = desc.getTarget().getObject();
		EReference reference = desc.getEReference();
		if (reference.isMany()) {
			@SuppressWarnings("unchecked")
			List<Object> list = (EList<Object>) source.eGet(reference, false);
			list.set(desc.getIndexInList(), target);
		} else {
			source.eSet(reference, target);
		}
	}
	return resource;
}
 
Example 2
Source File: ChartElementUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param eContainer
 *            EMF model container
 * @param attribute
 *            the attribute that belongs to the container.
 * @param value
 *            value
 * @param isUnset
 *            indicates if executing unset action.
 */
public static void setEObjectAttribute( EObject eContainer,
		String attribute, Object value, boolean isUnset )
{
	EStructuralFeature esf = eContainer.eClass( )
			.getEStructuralFeature( attribute );
	if ( esf == null )
	{
		return;
	}
	if ( isUnset )
	{
		eContainer.eUnset( esf );
	}
	else
	{
		eContainer.eSet( esf, value );
	}
}
 
Example 3
Source File: IfcStepDeserializer.java    From IfcPlugins with GNU Affero General Public License v3.0 6 votes vote down vote up
private void readReference(String val, EObject object, EStructuralFeature structuralFeature) throws DeserializeException {
	if (structuralFeature == Ifc4Package.eINSTANCE.getIfcIndexedColourMap_Opacity()) {
		// HACK for IFC4/add1/add2
		object.eSet(structuralFeature, 0D);
		object.eSet(structuralFeature.getEContainingClass().getEStructuralFeature(structuralFeature.getName() + "AsString"), "0");
		return;
	}

	long referenceId;
	try {
		referenceId = Long.parseLong(val.substring(1));
	} catch (NumberFormatException e) {
		throw new DeserializeException(DeserializerErrorCode.INVALID_REFERENCE, lineNumber, "'" + val + "' is not a valid reference");
	}
	if (model.contains(referenceId)) {
		object.eSet(structuralFeature, model.get(referenceId));
	} else {
		waitingList.add(referenceId, new SingleWaitingObject(lineNumber, object, (EReference) structuralFeature));
	}
}
 
Example 4
Source File: EcoreUtil2Test.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testGetAllReferencedObjects() {
	EClass a = createEClass("a");
	EClass b = createEClass("b");
	
	EPackage pack = EcoreFactory.eINSTANCE.createEPackage();
	pack.setName("empty");
	pack.setNsPrefix("empty");
	pack.setNsURI("empty");
	pack.getEClassifiers().add(a);
	pack.getEClassifiers().add(b);
	
	EReference ref = EcoreFactory.eINSTANCE.createEReference();
	a.getEStructuralFeatures().add(ref);
	ref.setUpperBound(1);
	ref.setEType(b);
	EObject objA = pack.getEFactoryInstance().create(a);
	EObject objB = pack.getEFactoryInstance().create(b);
	List<EObject> res = EcoreUtil2.getAllReferencedObjects(objA, ref);
	assertNotNull(res);
	assertTrue(res.isEmpty());
	res = EcoreUtil2.getAllReferencedObjects(objA, ref);
	assertNotNull(res);
	objA.eSet(ref, objB);
}
 
Example 5
Source File: ShortFragmentProviderTest.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
@BugTest(value = "DSL-601")
public void testLongFragment() {
  int reps = 100;
  EObject root = EcoreUtil.create(testClass);
  EObject parent = root;
  for (int i = 0; i < reps; i++) {
    EObject child = EcoreUtil.create(testClass);
    parent.eSet(testReference, child);
    parent = child;
  }

  ResourceImpl resource = new ResourceImpl();
  resource.getContents().add(root);

  String fragment = fragmentProvider.getFragment(parent, fragmentFallback);
  Assert.assertEquals("/0*" + (reps + 1), fragment);

  Assert.assertEquals(parent, fragmentProvider.getEObject(resource, fragment, fragmentFallback));
}
 
Example 6
Source File: N4JSLinker.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a proxy instance that will later on allow to lazily resolve the semantically referenced instance for the
 * given {@link CrossReference xref}.
 */
@SuppressWarnings("unchecked")
private void createAndSetProxy(N4JSResource resource, EObject obj, INode node, EReference eRef,
		CrossReference xref,
		IDiagnosticProducer diagnosticProducer) {
	final EObject proxy = createProxy(resource, obj, node, eRef, xref, diagnosticProducer);
	proxy.eSetDeliver(false);
	if (eRef.isMany()) {
		((InternalEList<EObject>) obj.eGet(eRef, false)).addUnique(proxy);
	} else {
		obj.eSet(eRef, proxy);
	}
}
 
Example 7
Source File: IRenameStrategy2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected void doRename(EObject target, RenameChange change, RenameContext context) {
	EAttribute nameAttribute = getNameEAttribute(target);
	if (nameAttribute != null) {
		target.eSet(nameAttribute, change.getNewName());
	} else {
		context.getIssues().add(RefactoringIssueAcceptor.Severity.WARNING, "Element of class " + target.eClass().getName() + " cannot be renamed.");
	}
}
 
Example 8
Source File: XtextResourceTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
private void modifySpielplatz() {
	EObject obj = resource.getParseResult().getRootASTElement();
	assertNotNull(obj);
	assertEquals("Spielplatz", obj.eClass().getName());
	EStructuralFeature feature = obj.eClass().getEStructuralFeature("groesse");
	assertNotNull(feature);
	assertEquals(1, obj.eGet(feature));
	obj.eSet(feature, 3);
}
 
Example 9
Source File: SerializationTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Test public void testSerializeFracton() {
	EObject compositeModel = factory.create(compositeModelClass);
	EObject firstModel = factory.create(modelClass);
	((List<EObject>) compositeModel.eGet(modelFeature)).add(firstModel);
	firstModel.eSet(idFeature, "a.b.c.d");
	firstModel.eSet(valueFeature, new BigDecimal("0.75"));
	String s = serialize(compositeModel);
	assertEquals("a.b.c.d : 75/100 ;", s);
}
 
Example 10
Source File: SerializationTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Test public void testSerializeTwoModels() {
	EObject compositeModel = factory.create(compositeModelClass);
	EObject firstModel = factory.create(modelClass);
	((List<EObject>) compositeModel.eGet(modelFeature)).add(firstModel);
	firstModel.eSet(idFeature, "a.b.c.d");
	EObject secondModel = factory.create(modelClass);
	((List<EObject>) compositeModel.eGet(modelFeature)).add(secondModel);
	secondModel.eSet(idFeature, "e.f.g.h");
	String s = serialize(compositeModel);
	assertEquals("a.b.c.d ; e.f.g.h ;", s);
}
 
Example 11
Source File: Bpmn2ResourceImpl.java    From fixflow with Apache License 2.0 5 votes vote down vote up
/**
 * Set the ID attribute of cur to a generated ID, if it is not already set.
 * @param obj The object whose ID should be set.
 */
protected static void setIdIfNotSet(EObject obj) {
    if (obj.eClass() != null) {
        EStructuralFeature idAttr = obj.eClass().getEIDAttribute();
        if (idAttr != null && !obj.eIsSet(idAttr)) {
            obj.eSet(idAttr, EcoreUtil.generateUUID());
        }
    }
}
 
Example 12
Source File: LazyLinker.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected void createAndSetProxy(EObject obj, INode node, EReference eRef) {
	final EObject proxy = createProxy(obj, node, eRef);
	if (eRef.isMany()) {
		((InternalEList<EObject>) obj.eGet(eRef, false)).addUnique(proxy);
	} else {
		obj.eSet(eRef, proxy);
	}
}
 
Example 13
Source File: EmfSerializer.java    From trainbenchmark with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createEdge(final String label, final Object from, final Object to) throws IOException {
	final EObject objectFrom = (EObject) from;
	final EStructuralFeature edgeType = objectFrom.eClass().getEStructuralFeature(label);

	if (edgeType.isMany()) {
		@SuppressWarnings("unchecked")
		final List<Object> l = (List<Object>) objectFrom.eGet(edgeType);
		l.add(to);
	} else {
		objectFrom.eSet(edgeType, to);
	}
}
 
Example 14
Source File: AbstractRenameStrategy.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected EObject setName(URI targetElementURI, String newName, ResourceSet resourceSet) {
	EObject targetElement = resourceSet.getEObject(targetElementURI, false);
	if (targetElement == null) {
		throw new RefactoringException("Target element not loaded.");
	}
	targetElement.eSet(nameAttribute, newName);
	return targetElement;
}
 
Example 15
Source File: AbstractMapper.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
protected void replaceName ( final EObject object, final EStructuralFeature feature )
{
    final String hostname = (String)object.eGet ( feature );

    if ( hostname == null )
    {
        return;
    }

    final Mappings mappings = getMappings ();

    for ( final MappingEntry entry : mappings.getEntries () )
    {
        final String newName = entry.map ( hostname );
        if ( newName != null )
        {
            object.eSet ( feature, newName );
            return;
        }
    }

    switch ( mappings.getFallbackMode () )
    {
        case IGNORE:
            return;
        case FAIL:
            throw new IllegalStateException ( String.format ( "No node mapping for: %s", hostname ) );
    }
}
 
Example 16
Source File: ConfigurationHandler.java    From openhab1-addons with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Fills in the configuration into the configuration object and adds it to the {@link OHConfig}.
 *
 * @param ohtfDevice The device specific configuration object {@link OHTFDevice}.
 * @param deviceConfig The device configuration as {@code Map} of {@code Strings}.
 * @throws ConfigurationException
 */
private void fillupConfig(OHTFDevice<?, ?> ohtfDevice, Map<String, String> deviceConfig)
        throws ConfigurationException {
    String uid = deviceConfig.get(ConfigKey.uid.name());
    if (uid == null || uid.equals("")) {
        // das kommt hier gar nie an
        logger.error("===== uid missing");
        throw new ConfigurationException(deviceConfig.toString(),
                "config is an invalid missing uid: openhab.cfg has to be fixed!");
    } else {
        logger.debug("*** uid is \"{}\"", uid);
    }
    ohtfDevice.setUid(uid);
    String subid = deviceConfig.get(ConfigKey.subid.name());
    if (subid != null) {
        if (!ohtfDevice.isValidSubId(subid)) {
            throw new ConfigurationException(subid,
                    String.format("\"%s\" is an invalid subId: openhab.cfg has to be fixed!", subid));
        }
        logger.trace("fillupConfig ohtfDevice subid {}", subid);
        ohtfDevice.setSubid(subid);
    }
    if (ohConfig.getConfigByTFId(uid, subid) != null) {
        throw new ConfigurationException(String.format("uid: %s subId: %s", uid, subid),
                String.format("%s: duplicate device config for uid \"%s\" and subId \"%s\": fix openhab.cfg",
                        LoggerConstants.CONFIG, uid, subid));
    }
    String symbolicName = deviceConfig.get(ConfigKeyAdmin.ohId.name());
    if (ohConfig.getConfigByOHId(symbolicName) != null) {
        throw new ConfigurationException(String.format("symbolic name: %s", symbolicName),
                String.format("%s: duplicate device config for symbolic name \"%s\": fix openhab.cfg",
                        LoggerConstants.CONFIG, symbolicName));
    }
    ohtfDevice.setOhid(symbolicName);

    EObject tfConfig = ohtfDevice.getTfConfig();
    EList<EStructuralFeature> features = null;
    if (tfConfig != null) {
        features = tfConfig.eClass().getEAllStructuralFeatures();
    }
    ArrayList<String> configKeyList = new ArrayList<String>();
    for (ConfigKeyAdmin configKey : ConfigKeyAdmin.values()) {
        configKeyList.add(configKey.toString());
    }
    for (String property : deviceConfig.keySet()) {
        if (configKeyList.contains(property)) {
            continue;
        } else {
            logger.trace("{} found  property {}", LoggerConstants.CONFIG, property);
        }

        if (features != null) {
            for (EStructuralFeature feature : features) {
                logger.trace("found feature: {}", feature.getName());
                if (feature.getName().equals(property)) {
                    logger.trace("{} feature type {}", LoggerConstants.CONFIG,
                            feature.getEType().getInstanceClassName());
                    logger.debug("configuring feature: {} for uid {} subid {}", feature.getName(), uid, subid);
                    String className = feature.getEType().getInstanceClassName();
                    if (className.equals("int") || className.equals("java.lang.Integer")) {
                        tfConfig.eSet(feature, Integer.parseInt(deviceConfig.get(property)));
                    } else if (className.equals("short") || className.equals("java.lang.Short")) {
                        tfConfig.eSet(feature, Short.parseShort(deviceConfig.get(property)));
                    } else if (className.equals("long") || className.equals("java.lang.Long")) {
                        tfConfig.eSet(feature, Long.parseLong(deviceConfig.get(property)));
                    } else if (className.equals("boolean") || className.equals("java.lang.Boolean")) {
                        logger.debug("{} found boolean value", LoggerConstants.CONFIG);
                        tfConfig.eSet(feature, Boolean.parseBoolean(deviceConfig.get(property)));
                    } else if (className.equals("java.lang.String")) {
                        logger.debug("{} found String value", LoggerConstants.CONFIG);
                        tfConfig.eSet(feature, deviceConfig.get(property));
                    } else if (className.equals("java.math.BigDecimal")) {
                        logger.debug("{} found BigDecimal value", LoggerConstants.CONFIG);
                        tfConfig.eSet(feature, new BigDecimal(deviceConfig.get(property)));
                        // } else if (feature.getEType().getInstanceClassName().equals("EList")){
                        // logger.debug("{} found EList value", LoggerConstants.CONFIG);
                        // List<String> strings = new
                        // ArrayList<String>(Arrays.asList(deviceConfig.get(property).trim().split("\\s+")));
                        // tfConfig.eSet(feature, strings);
                    } else {
                        throw new ConfigurationException(feature.getName(),
                                "unsupported configuration type needed: " + className);
                    }
                    break;
                }
            }
        }
    }

    ohConfig.getOhTfDevices().add(ohtfDevice);
}
 
Example 17
Source File: DefaultReferenceDescriptionTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Test public void testSpecialReferences() {
	EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
	ePackage.setName("test");
	ePackage.setNsPrefix("test");
	ePackage.setNsURI("test");

	EClass eClass = EcoreFactory.eINSTANCE.createEClass();
	eClass.setName("Test");
	eClass.getESuperTypes().add(EcorePackage.Literals.EPACKAGE);
	ePackage.getEClassifiers().add(eClass);

	EReference eReference1 = EcoreFactory.eINSTANCE.createEReference();
	eReference1.setContainment(false);
	eReference1.setName("onlyExportedRef");
	eReference1.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference1);

	EReference eReference2 = EcoreFactory.eINSTANCE.createEReference();
	eReference2.setContainment(true);
	eReference2.setName("containmentRef");
	eReference2.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference2);

	EReference eReference3 = EcoreFactory.eINSTANCE.createEReference();
	eReference3.setContainment(false);
	eReference3.setTransient(true);
	eReference3.setName("transientRef");
	eReference3.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference3);

	EReference eReference4 = EcoreFactory.eINSTANCE.createEReference();
	eReference4.setContainment(false);
	eReference4.setVolatile(true);
	eReference4.setName("volatileRef");
	eReference4.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference4);

	EReference eReference5 = EcoreFactory.eINSTANCE.createEReference();
	eReference5.setContainment(false);
	eReference5.setDerived(true);
	eReference5.setName("derivedRef");
	eReference5.setEType(EcorePackage.Literals.EPACKAGE);
	eClass.getEStructuralFeatures().add(eReference5);

	EObject object = ePackage.getEFactoryInstance().create(eClass);
	object.eSet(EcorePackage.Literals.ENAMED_ELEMENT__NAME, "testname");
	object.eSet(eReference1, EcorePackage.eINSTANCE);
	object.eSet(eReference2, ePackage.getEFactoryInstance().create(eClass));
	object.eSet(eReference3, EcorePackage.eINSTANCE);
	object.eSet(eReference4, EcorePackage.eINSTANCE);
	object.eSet(eReference5, EcorePackage.eINSTANCE);

	Resource testResource = new XMIResourceImpl(URI.createPlatformResourceURI("test.ecore", true));
	testResource.getContents().add(object);
	IResourceDescription resourceDescription = createResourceDescription(testResource);
	assertEquals("Only one external reference expected", 1, size(resourceDescription.getReferenceDescriptions()));
	IReferenceDescription referenceDescription = resourceDescription.getReferenceDescriptions().iterator().next();
	assertEquals(-1, referenceDescription.getIndexInList());
	assertEquals(EcoreUtil.getURI(object), referenceDescription.getSourceEObjectUri());
	assertEquals(eReference1, referenceDescription.getEReference());
	assertEquals(EcoreUtil.getURI(EcorePackage.eINSTANCE), referenceDescription.getTargetEObjectUri());
	assertEquals(EcoreUtil.getURI(object), referenceDescription.getContainerEObjectURI());
}
 
Example 18
Source File: DefaultReferenceDescriptionTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Test public void testCrossResourceContainment() {
	EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
	ePackage.setName("test");
	ePackage.setNsPrefix("test");
	ePackage.setNsURI("test");

	EClass eClass = EcoreFactory.eINSTANCE.createEClass();
	eClass.setName("Test");
	ePackage.getEClassifiers().add(eClass);
	
	EAttribute nameAttribute = EcoreFactory.eINSTANCE.createEAttribute();
	nameAttribute.setName("name");
	nameAttribute.setID(true);
	nameAttribute.setEType(EcorePackage.Literals.ESTRING);
	eClass.getEStructuralFeatures().add(nameAttribute);

	EReference containmentRef = EcoreFactory.eINSTANCE.createEReference();
	containmentRef.setContainment(true);
	containmentRef.setName("crossResourceContainment");
	containmentRef.setEType(eClass);
	containmentRef.setResolveProxies(true);
	eClass.getEStructuralFeatures().add(containmentRef);
	
	EReference containerRef = EcoreFactory.eINSTANCE.createEReference();
	containerRef.setName("containerRef");
	containerRef.setEType(eClass);
	containerRef.setResolveProxies(true);
	containerRef.setEOpposite(containmentRef);
	containmentRef.setEOpposite(containerRef);
	eClass.getEStructuralFeatures().add(containerRef);

	EObject container = ePackage.getEFactoryInstance().create(eClass);
	EObject child = ePackage.getEFactoryInstance().create(eClass);
	
	Resource containerResource = new XMIResourceImpl(URI.createPlatformResourceURI("container.ecore", true));
	Resource childResource = new XMIResourceImpl(URI.createPlatformResourceURI("child.ecore", true));
	ResourceSet resourceSet = new ResourceSetImpl();
	resourceSet.getResources().add(containerResource);
	resourceSet.getResources().add(childResource);
	
	containerResource.getContents().add(container);
	childResource.getContents().add(child);
	
	container.eSet(containmentRef, child);
	assertTrue(container.eResource() != child.eResource());
	
	{ 
		IResourceDescription containerDescription = createResourceDescription(containerResource);
		IReferenceDescription onlyContainerElement = Iterables.getOnlyElement(containerDescription.getReferenceDescriptions());
		assertEquals(-1, onlyContainerElement.getIndexInList());
		assertEquals(EcoreUtil.getURI(container), onlyContainerElement.getSourceEObjectUri());
		assertEquals(containmentRef, onlyContainerElement.getEReference());
		assertEquals(EcoreUtil.getURI(child), onlyContainerElement.getTargetEObjectUri());
	}
	{
		IResourceDescription childDescription = createResourceDescription(childResource);
		IReferenceDescription onlyChildElement = Iterables.getOnlyElement(childDescription.getReferenceDescriptions());
		assertEquals(-1, onlyChildElement.getIndexInList());
		assertEquals(EcoreUtil.getURI(child), onlyChildElement.getSourceEObjectUri());
		assertEquals(containerRef, onlyChildElement.getEReference());
		assertEquals(EcoreUtil.getURI(container), onlyChildElement.getTargetEObjectUri());
	}
}
 
Example 19
Source File: CreateRegionCommand.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
protected EObject doDefaultElementCreation(int index) {
	EObject result = null;
	EReference reference = getContainmentFeature();
	EClass eClass = getElementType().getEClass();

	if (reference != null) {
		EObject container = getElementToEdit();

		if (container != null) {

			IResourceHelper helper = Util.getHelper(container.eResource());

			if (helper != null) {

				result = helper.create(eClass);

			} else {
				result = eClass.getEPackage().getEFactoryInstance()
						.create(eClass);
			}

			if (FeatureMapUtil.isMany(container, reference)) {
				((List) container.eGet(reference)).add(index, result);
			} else {
				container.eSet(reference, result);
			}

			return result;
		}
	}

	IStatus status = (result != null) ? Status.OK_STATUS : new Status(
			Status.ERROR, DiagramActivator.PLUGIN_ID,
			"CreateRegionCommand: No Region created: "
					+ getElementType().getDisplayName());

	setDefaultElementCreationStatus(status);

	return result;
}
 
Example 20
Source File: EObjectFeatureMerger.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
private EObject merge(final EObject from, final EObject to, final Collection<Object> visitedObjects) {

		if (null == from || null == to) {
			return null;
		}

		// This is against cycles through EReferences.
		if (visitedObjects.contains(from) || visitedObjects.contains(to)) {
			return to;
		}

		visitedObjects.add(to);
		visitedObjects.add(from);

		final Collection<EStructuralFeature> fromFeatures = from.eClass().getEAllStructuralFeatures();

		for (final EStructuralFeature feature : fromFeatures) {
			if (-1 != to.eClass().getFeatureID(feature) && feature.isChangeable()) {
				if (from.eIsSet(feature)) {
					final Object fromValue = from.eGet(feature, true);
					final Object toValue = to.eGet(feature, true);
					if (null == toValue) {
						to.eSet(feature, fromValue);
					} else {
						if (feature.isMany()) {
							@SuppressWarnings("unchecked")
							final Collection<Object> toManyValue = (Collection<Object>) toValue;
							@SuppressWarnings("unchecked")
							final Collection<Object> fromManyValue = (Collection<Object>) fromValue;
							for (final Iterator<Object> itr = fromManyValue.iterator(); itr.hasNext(); /**/) {
								final Object fromElement = itr.next();
								if (!contains(toManyValue, fromElement)) {
									itr.remove();
									toManyValue.add(fromElement);
								}
							}
						} else {
							if (feature instanceof EAttribute) {
								to.eSet(feature, fromValue);
							} else if (feature instanceof EReference) {
								to.eSet(feature, merge((EObject) fromValue, (EObject) toValue, visitedObjects));
							}
						}
					}
				}
			}
		}
		return to;
	}