{
if (leftOwner == null && rightOwner == null) {
if (local) {
Union union = new Union();
for (SignedConnection member : members) {
union.addArg(new OwnedTupleExpr(member, node.clone()));
}
node.replaceWith(union);
}
}
else if (leftOwner == rightOwner) {
node.replaceWith(new OwnedTupleExpr(leftOwner, node.clone()));
}
else {
if (local) {
if (rightOwner == null) {
node.replaceWith(new OwnedTupleExpr(leftOwner, node.clone()));
}
else if (leftOwner == null) {
Union union = new Union();
for (SignedConnection member : members) {
if (rightOwner == member) {
union.addArg(new OwnedTupleExpr(member, node.clone()));
}
else {
union.addArg(new OwnedTupleExpr(member, node.getLeftArg().clone()));
}
}
node.replaceWith(union);
}
else {
node.replaceWith(new OwnedTupleExpr(leftOwner, node.getLeftArg().clone()));
}
}
else {
if (leftOwner != null) {
node.getLeftArg().replaceWith(new OwnedTupleExpr(leftOwner, node.getLeftArg().clone()));
}
if (rightOwner != null) {
node.getRightArg().replaceWith(new OwnedTupleExpr(rightOwner, node.getRightArg().clone()));
}
}
}
}