|
@@ -10,6 +10,7 @@ import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Link;
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Port;
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Protocol;
|
|
|
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SimulationManager;
|
|
|
import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.SmartDevice;
|
|
|
|
|
|
|
|
@@ -504,6 +505,12 @@ public class Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * Changes the type of the connection to the new Type and updates all references
|
|
|
+ * @param connection connection to be updated
|
|
|
+ * @param newConnectionClass class of new type
|
|
|
+ * @return newly created connection
|
|
|
+ */
|
|
|
public Connection changeConnectionType(Connection connection, Class<? extends Connection> newConnectionClass) {
|
|
|
|
|
|
Connection newCon = null;
|
|
@@ -632,7 +639,7 @@ public class Controller {
|
|
|
* @param c Connection to be removed
|
|
|
* @param l Link to be removed
|
|
|
*/
|
|
|
- private void removeConnectionFromLink(Connection c, Link l) {
|
|
|
+ public void removeConnectionFromLink(Connection c, Link l) {
|
|
|
if(c!=null && c.getLink()==l){
|
|
|
c.setLink(null);
|
|
|
}
|
|
@@ -640,4 +647,24 @@ public class Controller {
|
|
|
l.removeConnection(c);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * Reset Simulation
|
|
|
+ *
|
|
|
+ * @param timestep
|
|
|
+ */
|
|
|
+ public void resetSimulation(long timestep){
|
|
|
+ for(SmartDevice d: model.getDevices())
|
|
|
+ for(Port p:d.getPorts())
|
|
|
+ if(p.getLastTrigger()>timestep)
|
|
|
+ p.setLastTrigger(timestep);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * Returns the Simulation Manager of the Program
|
|
|
+ * @return Simulation Manager
|
|
|
+ */
|
|
|
+ public SimulationManager getSimulationManager() {
|
|
|
+ return model.getSim();
|
|
|
+ }
|
|
|
}
|