{
if (eObject.eIsSet(eReference))
{
if (eReference.isMany())
{
InternalEList source = (InternalEList)eObject.eGet(eReference);
InternalEList target = (InternalEList)copyEObject.eGet(getTarget(eReference));
if (source.isEmpty())
{
target.clear();
}
else
{
boolean isBidirectional = eReference.getEOpposite() != null;
int index = 0;
for (Iterator k = resolveProxies ? source.iterator() : source.basicIterator(); k.hasNext();)
{
Object referencedEObject = k.next();
Object copyReferencedEObject = get(referencedEObject);
if (copyReferencedEObject == null)
{
if (useOriginalReferences && !isBidirectional)
{
target.addUnique(index, referencedEObject);
++index;
}
}
else
{
if (isBidirectional)
{
int position = target.indexOf(copyReferencedEObject);
if (position == -1)
{
target.addUnique(index, copyReferencedEObject);
}
else if (index != position)
{
target.move(index, copyReferencedEObject);
}
}
else
{
target.addUnique(index, copyReferencedEObject);
}
++index;
}
}
}