|
@@ -49,6 +49,8 @@ import classes.Flexibility;
|
|
|
import classes.HolonElement;
|
|
|
import classes.HolonObject;
|
|
|
import classes.HolonSwitch;
|
|
|
+import classes.IdCounterElem;
|
|
|
+import classes.Node;
|
|
|
import classes.HolonElement.Priority;
|
|
|
import ui.controller.Control;
|
|
|
import ui.controller.FlexManager.FlexState;
|
|
@@ -451,7 +453,6 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
|
|
|
|
|
|
protected double evaluatePosition(List<Integer> positionToEvaluate) {
|
|
|
- runProgressbar.step();
|
|
|
control.getSimManager().resetFlexManagerForTimeStep(control.getModel().getCurIteration());
|
|
|
|
|
|
setState(positionToEvaluate);
|
|
@@ -472,8 +473,7 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
- System.out.println("-->");
|
|
|
+ runProgressbar.step();
|
|
|
double sum = 0;
|
|
|
double step = 0.1;
|
|
|
int steppsDone = 0;
|
|
@@ -487,7 +487,6 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
sum += evaluateState(actualstate);
|
|
|
steppsDone++;
|
|
|
}
|
|
|
- System.out.println("<--");
|
|
|
|
|
|
return sum /(double) steppsDone;
|
|
|
}
|
|
@@ -751,6 +750,22 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
accessGroupNode.put(hO, groupnode);
|
|
|
}
|
|
|
}
|
|
|
+ if(aCps instanceof HolonSwitch) {
|
|
|
+ HolonSwitch hSwitch = (HolonSwitch) aCps;
|
|
|
+ accessIntToObject.put(++countForAccessMap, hSwitch);
|
|
|
+ accessObjectToInt.put(hSwitch, countForAccessMap);
|
|
|
+ if(groupnode != null) {
|
|
|
+ accessGroupNode.put(hSwitch, groupnode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(aCps instanceof Node) {
|
|
|
+ Node node = (Node) aCps;
|
|
|
+ accessIntToObject.put(++countForAccessMap, node);
|
|
|
+ accessObjectToInt.put(node, countForAccessMap);
|
|
|
+ if(groupnode != null) {
|
|
|
+ accessGroupNode.put(node, groupnode);
|
|
|
+ }
|
|
|
+ }
|
|
|
else if(aCps instanceof GroupNode) {
|
|
|
generateAccess(((GroupNode)aCps).getNodes(), (GroupNode) aCps);
|
|
|
}
|
|
@@ -772,10 +787,10 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
edgeList.add(edge);
|
|
|
|
|
|
if(!accessObjectToInt.containsKey(edge.getA())) {
|
|
|
- console.println("Node A from Edge[" + edge + "] not exist");
|
|
|
+ console.println("Node A [" + edge.getA() + "] from Edge[" + edge + "] not exist");
|
|
|
continue;
|
|
|
} else if (!accessObjectToInt.containsKey(edge.getB())) {
|
|
|
- console.println("Node B from Edge[" + edge + "] not exist");
|
|
|
+ console.println("Node B [" + edge.getB() + "]from Edge[" + edge + "] not exist");
|
|
|
continue;
|
|
|
}
|
|
|
IndexCable cable = new IndexCable(accessObjectToInt.get(edge.getA()), accessObjectToInt.get(edge.getB()));
|
|
@@ -812,6 +827,7 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
int middleX = (fromObject.getPosition().x + toObject.getPosition().x)/2;
|
|
|
int middleY = (fromObject.getPosition().y + toObject.getPosition().y)/2;
|
|
|
HolonSwitch newSwitch = new HolonSwitch("AddedSwitch");
|
|
|
+ newSwitch.setId(IdCounterElem.nextId());
|
|
|
newSwitch.setPosition(middleX, middleY);
|
|
|
|
|
|
if(accessGroupNode.containsKey(fromObject)) {
|
|
@@ -823,7 +839,7 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
groupnode.getNodes().add(newSwitch);
|
|
|
accessSwitchGroupNode.put(newSwitch, groupnode);
|
|
|
}else {
|
|
|
- control.getModel().getObjectsOnCanvas().add(newSwitch);
|
|
|
+ control.getModel().getObjectsOnCanvas().add(newSwitch);
|
|
|
}
|
|
|
|
|
|
this.switchList.add(newSwitch);
|