|
@@ -242,13 +242,13 @@ public class NodeController {
|
|
|
}
|
|
|
node.getOldEdges().removeAll(lostEdges);
|
|
|
|
|
|
- // LOST = DIE IN NODE SIND, TOSEARCH = IHRE PARTNER DIE IN ANDEREN NODES
|
|
|
- // SIND
|
|
|
-
|
|
|
+ // für alle Edges für die nix passendes gefunden ist
|
|
|
for (CpsEdge edge : lostEdges) {
|
|
|
AbstractCpsObject toSearch = null;
|
|
|
AbstractCpsObject lost = null;
|
|
|
+ boolean foundCps = false;
|
|
|
|
|
|
+ // bestimmung welcher verloren ist und wen man suchen muss
|
|
|
if (lostChildren.contains(edge.getA())) {
|
|
|
toSearch = edge.getB();
|
|
|
lost = edge.getA();
|
|
@@ -256,12 +256,20 @@ public class NodeController {
|
|
|
toSearch = edge.getA();
|
|
|
lost = edge.getB();
|
|
|
}
|
|
|
+ // wenn der zu suchende ein CpsUpperNode war
|
|
|
if (toSearch instanceof CpsUpperNode) {
|
|
|
+
|
|
|
+ // guck einfach in den Connections des Verlorenen nach Edges die
|
|
|
+ // auf der Canvas sind.
|
|
|
for (CpsEdge e : lost.getConnections()) {
|
|
|
- if ((found.contains(e.getA()) || found.contains(e.getB())) && !node.getOldEdges().contains(e))
|
|
|
+ if (( (found.contains(e.getA()) && !found.equals(lost)) || (found.contains(e.getB()) && !found.equals(lost)) ) && !node.getOldEdges().contains(e)) {
|
|
|
node.getOldEdges().add(e);
|
|
|
+ foundCps = true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- } else
|
|
|
+
|
|
|
+ } if (!foundCps)
|
|
|
outerLoop: for (AbstractCpsObject cps : found) {
|
|
|
if (!cps.equals(node) && !lostChildren.contains(cps))
|
|
|
if (backtrackLostChild(cps, toSearch, lost)) {
|
|
@@ -272,11 +280,11 @@ public class NodeController {
|
|
|
continue outerLoop;
|
|
|
|
|
|
if (!lookforDuplicates(cps, lost, node.getOldEdges())) {
|
|
|
-
|
|
|
+
|
|
|
CpsEdge temp = new CpsEdge(cps, lost, edge.getCapacity());
|
|
|
node.getOldEdges().add(temp);
|
|
|
-
|
|
|
- //break;
|
|
|
+// if(cps instanceof CpsUpperNode)
|
|
|
+// ((CpsUpperNode)cps).getOldEdges().add(edge);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -290,6 +298,14 @@ public class NodeController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Just checking if an Egde already exists
|
|
|
+ *
|
|
|
+ * @param a
|
|
|
+ * @param b
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private boolean lookforDuplicates(AbstractCpsObject a, AbstractCpsObject b, ArrayList<CpsEdge> list) {
|
|
|
for (CpsEdge cpsEdge : list) {
|
|
|
if ((a.equals(cpsEdge.getA()) && b.equals(cpsEdge.getB()))
|