|
@@ -15,14 +15,14 @@ import model.Node;
|
|
|
import ui.model.ExitCable.ExitCableState;
|
|
|
|
|
|
public class VisualRepresentationalState {
|
|
|
- private ArrayList<Supplier> supplierList = new ArrayList<Supplier>();
|
|
|
- private ArrayList<Passiv> passivList= new ArrayList<Passiv>();
|
|
|
- private ArrayList<Consumer> consumerList= new ArrayList<Consumer>();
|
|
|
- private ArrayList<Node> nodeList= new ArrayList<Node>();
|
|
|
- private ArrayList<DecoratedCable> cableList= new ArrayList<DecoratedCable>();
|
|
|
- private ArrayList<DecoratedSwitch> switchList= new ArrayList<DecoratedSwitch>();
|
|
|
- private ArrayList<DecoratedGroupNode> groupNodeList= new ArrayList<DecoratedGroupNode>();
|
|
|
- private ArrayList<ExitCable> exitCableList= new ArrayList<ExitCable>();
|
|
|
+ private ArrayList<Supplier> supplierList = new ArrayList<>();
|
|
|
+ private ArrayList<Passiv> passivList= new ArrayList<>();
|
|
|
+ private ArrayList<Consumer> consumerList= new ArrayList<>();
|
|
|
+ private ArrayList<Node> nodeList= new ArrayList<>();
|
|
|
+ private ArrayList<Edge> cableList= new ArrayList<>();
|
|
|
+ private ArrayList<DecoratedSwitch> switchList= new ArrayList<>();
|
|
|
+ private ArrayList<DecoratedGroupNode> groupNodeList= new ArrayList<>();
|
|
|
+ private ArrayList<ExitCable> exitCableList= new ArrayList<>();
|
|
|
|
|
|
//ForFastAccessIndividualGroupNodes:
|
|
|
private HashMap<GroupNode, DecoratedGroupNode> createdGroupNodes;
|
|
@@ -47,7 +47,7 @@ public class VisualRepresentationalState {
|
|
|
public ArrayList<Node> getNodeList() {
|
|
|
return nodeList;
|
|
|
}
|
|
|
- public ArrayList<DecoratedCable> getCableList() {
|
|
|
+ public ArrayList<Edge> getCableList() {
|
|
|
return cableList;
|
|
|
}
|
|
|
public ArrayList<DecoratedSwitch> getSwitchList() {
|
|
@@ -102,11 +102,11 @@ public class VisualRepresentationalState {
|
|
|
}
|
|
|
this.createdHolonObjects.put(pas.getModel(), pas);
|
|
|
}
|
|
|
- for(DecoratedCable cable : net.getDecoratedCableList()) {
|
|
|
+ for(Edge cable : net.getDecoratedCableList()) {
|
|
|
addCable(cable, inGroupEdges, inGroupObjects,createdGroupNodes, exitCables);
|
|
|
}
|
|
|
}
|
|
|
- for(DecoratedCable cable : stateFromThisTimestep.getLeftOverEdges()) {
|
|
|
+ for(Edge cable : stateFromThisTimestep.getLeftOverEdges()) {
|
|
|
addCable(cable, inGroupEdges, inGroupObjects, createdGroupNodes, exitCables);
|
|
|
}
|
|
|
for(Node node : minimumModel.getNodeList()) {
|
|
@@ -135,12 +135,12 @@ public class VisualRepresentationalState {
|
|
|
addTreeNode(root, dGroupNode, 1, fastaccess);
|
|
|
}
|
|
|
for(IntermediateCalculationCable cable : exitCables) {
|
|
|
- createExitEdgesV2(root,cable.getCable() , cable.getInsideObject(),cable.getInsideUpperNode(),cable.getOusideObject(),cable.getOutsideUpperNode(), fastaccess);
|
|
|
+ createExitEdgesV2(root,cable , cable.getInsideObject(),cable.getInsideUpperNode(),cable.getOusideObject(),cable.getOutsideUpperNode(), fastaccess);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void createExitEdgesV2(TreeNode<TreeGroupNodeData> root, DecoratedCable cable, AbstractCanvasObject insideObject,
|
|
|
+ private void createExitEdgesV2(TreeNode<TreeGroupNodeData> root, IntermediateCalculationCable cable, AbstractCanvasObject insideObject,
|
|
|
GroupNode insideUpperNode, AbstractCanvasObject ousideObject, GroupNode outsideUpperNode, HashMap<GroupNode, TreeNode<TreeGroupNodeData>> fastaccess) {
|
|
|
|
|
|
|
|
@@ -206,33 +206,33 @@ public class VisualRepresentationalState {
|
|
|
if(info.previous == Info.Nothing) {
|
|
|
if(info.next == Info.Child) {
|
|
|
state = ExitCableState.DOWN;
|
|
|
- mylist.add(new ExitCable(state, insideObject, info.nextGroupNode, cable));
|
|
|
+ mylist.add(new ExitCable(state, insideObject, info.nextGroupNode, cable.getEdge()));
|
|
|
}else if(info.next == Info.Parent) {
|
|
|
state = ExitCableState.UP;
|
|
|
- mylist.add(new ExitCable(state, insideObject, ousideObject, cable));
|
|
|
+ mylist.add(new ExitCable(state, insideObject, ousideObject, cable.getEdge()));
|
|
|
}else {
|
|
|
System.out.println("Error in VisualState");
|
|
|
}
|
|
|
}else if(info.previous == Info.Child) {
|
|
|
if(info.next == Info.Child) {
|
|
|
state = ExitCableState.DOWNDOWN;
|
|
|
- mylist.add(new ExitCable(state, info.previousGroupNode, info.nextGroupNode, cable));
|
|
|
+ mylist.add(new ExitCable(state, info.previousGroupNode, info.nextGroupNode, cable.getEdge()));
|
|
|
}else if(info.next == Info.Parent) {
|
|
|
state = ExitCableState.DOWNUP;
|
|
|
- mylist.add(new ExitCable(state, info.previousGroupNode, ousideObject, cable));
|
|
|
+ mylist.add(new ExitCable(state, info.previousGroupNode, ousideObject, cable.getEdge()));
|
|
|
}else {
|
|
|
state = ExitCableState.DOWN;
|
|
|
- mylist.add(new ExitCable(state, info.previousGroupNode, ousideObject, cable));
|
|
|
+ mylist.add(new ExitCable(state, info.previousGroupNode, ousideObject, cable.getEdge()));
|
|
|
}
|
|
|
}else {//(info.previous == Info.Parent)
|
|
|
if(info.next == Info.Child) {
|
|
|
state = ExitCableState.DOWNUP;
|
|
|
- mylist.add(new ExitCable(state, info.nextGroupNode, insideObject, cable));
|
|
|
+ mylist.add(new ExitCable(state, info.nextGroupNode, insideObject, cable.getEdge()));
|
|
|
}else if(info.next == Info.Parent) {
|
|
|
System.out.println("Error in VisualState");
|
|
|
}else {
|
|
|
state = ExitCableState.UP;
|
|
|
- mylist.add(new ExitCable(state, ousideObject, insideObject, cable));
|
|
|
+ mylist.add(new ExitCable(state, ousideObject, insideObject, cable.getEdge()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -263,26 +263,26 @@ public class VisualRepresentationalState {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void addCable(DecoratedCable cable, HashMap<Edge, ArrayList<GroupNode>> inGroupEdges, HashMap<AbstractCanvasObject, GroupNode> inGroupObjects,
|
|
|
+ private void addCable(Edge cable, HashMap<Edge, ArrayList<GroupNode>> inGroupEdges, HashMap<AbstractCanvasObject, GroupNode> inGroupObjects,
|
|
|
HashMap<GroupNode, DecoratedGroupNode> createdGroupNodes, ArrayList<IntermediateCalculationCable> exitCables) {
|
|
|
boolean isInGroup = false;
|
|
|
- if(inGroupObjects.containsKey(cable.getModel().getA())) {
|
|
|
+ if(inGroupObjects.containsKey(cable.getA())) {
|
|
|
isInGroup = true;
|
|
|
}
|
|
|
- if(inGroupObjects.containsKey(cable.getModel().getB())) {
|
|
|
+ if(inGroupObjects.containsKey(cable.getB())) {
|
|
|
isInGroup = true;
|
|
|
}
|
|
|
if(isInGroup) {
|
|
|
|
|
|
- boolean isIntern = inGroupObjects.get(cable.getModel().getA()) == inGroupObjects.get(cable.getModel().getB()); //Case null == null is not possible trough before Filtering MinimumModel#addUpperObjects(CpsUpperNode)
|
|
|
+ boolean isIntern = inGroupObjects.get(cable.getA()) == inGroupObjects.get(cable.getB()); //Case null == null is not possible trough before Filtering MinimumModel#addUpperObjects(CpsUpperNode)
|
|
|
if(isIntern) {
|
|
|
- DecoratedGroupNode groupNodeFromBoth = createdGroupNodes.get(inGroupObjects.get(cable.getModel().getA()));
|
|
|
+ DecoratedGroupNode groupNodeFromBoth = createdGroupNodes.get(inGroupObjects.get(cable.getA()));
|
|
|
groupNodeFromBoth.getInternCableList().add(cable);
|
|
|
}else {
|
|
|
- if(inGroupObjects.containsKey(cable.getModel().getA())) {
|
|
|
- exitCables.add(new IntermediateCalculationCable(cable, inGroupObjects.get(cable.getModel().getA()),inGroupObjects.get(cable.getModel().getB()), cable.getModel().getA(), cable.getModel().getB()));
|
|
|
- } else if(inGroupObjects.containsKey(cable.getModel().getB())) {
|
|
|
- exitCables.add(new IntermediateCalculationCable(cable, inGroupObjects.get(cable.getModel().getB()),inGroupObjects.get(cable.getModel().getA()), cable.getModel().getB(), cable.getModel().getA()));
|
|
|
+ if(inGroupObjects.containsKey(cable.getA())) {
|
|
|
+ exitCables.add(new IntermediateCalculationCable(cable, inGroupObjects.get(cable.getA()),inGroupObjects.get(cable.getB()), cable.getA(), cable.getB()));
|
|
|
+ } else if(inGroupObjects.containsKey(cable.getB())) {
|
|
|
+ exitCables.add(new IntermediateCalculationCable(cable, inGroupObjects.get(cable.getB()),inGroupObjects.get(cable.getA()), cable.getB(), cable.getA()));
|
|
|
}
|
|
|
|
|
|
}
|