3 import org.simgrid.msg.Host;
4 import org.simgrid.msg.HostNotFoundException;
6 import peersim.core.Node;
10 * This class can change the size of networks by adding and removing nodes, as
11 * {@link peersim.dynamics.DynamicNetwork} in peersim.
13 * @author Khaled Baati 09/02/2015
14 * @version version 1.1
16 public class PSGDynamicNetwork {
19 * Removes the node from the network.
22 * the node to be removed
24 public static void remove(Node node) {
25 // NodeHost.getHost(node).off();
26 // Host h=NodeHost.mapHostNode.get(node);
27 // NodeHost.mapHostNode.remove(node);
28 PSGSimulator.size = PSGSimulator.size - 1;
32 * Adds a node to the network.
35 * the node to be added
36 * @throws HostNotFoundException
38 public static void add(Node node) throws HostNotFoundException {
39 Host host = PSGPlatform.hostList[(int) node.getID()];
40 NodeHost.mapHostNode.put(node, host);
41 if (PSGPlatform.interfED)
42 new PSGProcessEvent(host, host.getName(), null).start();
43 PSGSimulator.size = PSGSimulator.size + 1;