X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/24dbcb1a8071fe684d776063f04b314d92094e8d..23da67335f942457b0d8b1f10e9849eba0eee9f7:/contrib/psg/src/psgsim/NodeHost.java diff --git a/contrib/psg/src/psgsim/NodeHost.java b/contrib/psg/src/psgsim/NodeHost.java deleted file mode 100644 index 1dce76fd42..0000000000 --- a/contrib/psg/src/psgsim/NodeHost.java +++ /dev/null @@ -1,74 +0,0 @@ -package psgsim; - -import org.simgrid.msg.Host; -import peersim.core.Network; -import peersim.core.Node; - -import java.util.Comparator; -import java.util.Map; -import java.util.TreeMap; - -/** - * - * NodeHost class used to make the mapping Node-Host. - * - * @author Khaled Baati 26/10/2014 - * @version version 1.1 - */ -public class NodeHost { - - /** - * A collection of map contained the couple (host,node) - */ - public static TreeMap mapHostNode = new TreeMap( - new Comparator() { - public int compare(Node n1, Node n2) { - return String.valueOf(n1.getID()).compareTo( - String.valueOf(n2.getID())); - } - }); - - /** - * The main method to make the mapping Node to Host in the - * {@link #mapHostNode} field - */ - public static void start() { - Host host = null; - for (Integer i = 0; i < PSGSimulator.size; i++) { - host = PSGPlatform.hostList[i]; - mapHostNode.put(Network.get(i), host); - } - } - - /** - * This static method gets a Node instance associated with a host of your - * platform. - * - * @param host - * The host associated in your platform. - * @return The node associated. - */ - public static Node getNode(Host host) { - for (Map.Entry element : mapHostNode.entrySet()) { - if (element.getValue() == host) - return element.getKey(); - } - return null; - } - - /** - * This static method gets a host instance associated with the node of your - * platform. - * - * @param node - * The node associated in your platform. - * @return The host associated, else return null (host doesn't exist). - */ - public static Host getHost(Node node) { - for (Map.Entry element : mapHostNode.entrySet()) { - if (element.getKey() == node) - return element.getValue(); - } - return null; - } -}