- if (ref1->canConnectTo(ref2)) {
- ok1 = ref1->connectTo(ref2);
- ok1 = ok1 & ref2->connectFrom(ref1);
- }
- if (ref2->canConnectTo(ref1)) {
- ok2 = ref2->connectTo(ref1);
- ok2 = ok2 & ref1->connectFrom(ref2);
+ // test the ref1->ref2 connection
+ if ((ref1->canConnectTo(ref2)) && (ref2->canConnectFrom(ref1))) {
+ ref1->connectTo(ref2);
+ ref2->connectFrom(ref1);
+ if ((asso1 != NULL) && (asso2 != NULL)) {
+ asso1->connectTo(asso2);
+ asso2->connectFrom(asso1);
+ }
+ ok1 = true;
+ }
+ // if the frist one did not work, test ref2->ref1
+ if ((ok1 == false) && (ref2->canConnectTo(ref1)) && (ref1->canConnectFrom(ref2))) {
+ ref2->connectTo(ref1);
+ ref1->connectFrom(ref2);
+ if ((asso1 != NULL) && (asso2 != NULL)) {
+ asso1->connectFrom(asso2);
+ asso2->connectTo(asso1);
+ }
+ ok2 = true;