X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/6e2b3026c6a496e81642c373796bd39dad33d2a6..2bdaa0aa3fab52f0808f60d9bbdabcd56d0efae9:/FunctionalInterface.cpp

diff --git a/FunctionalInterface.cpp b/FunctionalInterface.cpp
index 1237e74..eec7ea8 100644
--- a/FunctionalInterface.cpp
+++ b/FunctionalInterface.cpp
@@ -108,16 +108,16 @@ bool FunctionalInterface::canConnectTo(AbstractInterface *iface) {
   // first case: interface of blocks within the same group
   if (getOwner()->getParent() == iface->getOwner()->getParent()) {
 
-    if ((direction == Output) && (iface->getDirection() == Input)) return true;
-    if ((direction == InOut) && (iface->getDirection() == InOut)) return true;
+    if ((direction == Output) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true;
+    if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true;
   }
   // second case: iface = interface of the group that contains owner of this
   else if (getOwner()->getParent() == iface->getOwner()) {
-    if ((direction == Output) && (iface->getDirection() == Output)) return true;
-    if ((direction == InOut) && (iface->getDirection() == InOut)) return true;
+    if ((direction == Output) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true;
+    if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true;
   }
   else if ((getOwner()->isSourceBlock()) && (iface->getOwner()->isTopGroupBlock())) {
-    if ((direction == Output) && (iface->getDirection() == Input)) return true;
+    if ((direction == Output) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true;
   }
 
   return false;
@@ -146,12 +146,12 @@ bool FunctionalInterface::canConnectFrom(AbstractInterface *iface) {
 
   if (getOwner()->getParent() == iface->getOwner()->getParent()) {
 
-    if ((direction == Input) && (iface->getDirection() == Output)) return true;
-    if ((direction == InOut) && (iface->getDirection() == InOut)) return true;
+    if ((direction == Input) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true;
+    if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true;
   }
   else if (getOwner()->getParent() == iface->getOwner()) {
-    if ((direction == Input) && (iface->getDirection() == Input)) return true;
-    if ((direction == InOut) && (iface->getDirection() == InOut)) return true;
+    if ((direction == Input) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true;
+    if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true;
   }
 
   return false;