|
@@ -63,14 +63,14 @@ public class Main {
|
|
|
SmartDevice A = null, B = null, C = null;
|
|
|
for(int i = 0; i<5; i++){
|
|
|
A = new SmartDevice("SmartTV"+i);
|
|
|
- A.setX((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
- A.setY((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
+ A.setX((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
+ A.setY((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
B = new SmartDevice("SmartDoor"+i);
|
|
|
- B.setX((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
- B.setY((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
+ B.setX((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
+ B.setY((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
C = new SmartDevice("SmartLight"+i);
|
|
|
- C.setX((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
- C.setY((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
+ C.setX((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
+ C.setY((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
|
|
|
c.addSmartDevice(A);
|
|
|
c.addSmartDevice(B);
|
|
@@ -113,8 +113,8 @@ public class Main {
|
|
|
Link link = new SimpleLink("LossLess TCP-Network");
|
|
|
|
|
|
SmartDevice broker = new SmartDevice("MQTT-Broker");
|
|
|
- broker.setX((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
- broker.setY((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
+ broker.setX((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
+ broker.setY((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
c.addSmartDevice(broker);
|
|
|
|
|
|
Port brokerPort = new Port(broker, (short) 0);
|
|
@@ -133,16 +133,16 @@ public class Main {
|
|
|
con.addSmartDevice(brokerPort);
|
|
|
brokerPort.setConnection(con);
|
|
|
con.setStatus(Connection.ACTIVE);
|
|
|
- m.addConnectionNetwork(link);
|
|
|
+ c.addLink(link);
|
|
|
link.addConnection(con);
|
|
|
- m.addConnection(con);
|
|
|
+ c.addConnection(con);
|
|
|
|
|
|
SmartDevice A = null, B = null, C = null;
|
|
|
Port aP,bP,cP;
|
|
|
for(int i = 0; i<3; i++){
|
|
|
A = new SmartDevice("SmartTV"+i+"(Sub)");
|
|
|
- A.setX((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
- A.setY((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
+ A.setX((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
+ A.setY((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
link.addDevice(A);
|
|
|
A.addLink(link);
|
|
|
|
|
@@ -161,8 +161,8 @@ public class Main {
|
|
|
|
|
|
|
|
|
B = new SmartDevice("SmartDoor"+i+"(Pub)");
|
|
|
- B.setX((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
- B.setY((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
+ B.setX((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
+ B.setY((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
link.addDevice(B);
|
|
|
B.addLink(link);
|
|
|
|
|
@@ -179,8 +179,8 @@ public class Main {
|
|
|
c.addSmartDevice(B);
|
|
|
|
|
|
C = new SmartDevice("SmartLight"+i+"(Pub,Sub)");
|
|
|
- C.setX((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
- C.setY((int)(Math.random()*m.getWidth()-2*m.getDevice_visualization_radius())+m.getDevice_visualization_radius());
|
|
|
+ C.setX((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
+ C.setY((int)(Math.random()*c.getWidth()-2*c.getDevice_visualization_radius())+c.getDevice_visualization_radius());
|
|
|
link.addDevice(C);
|
|
|
C.addLink(link);
|
|
|
|