public static int getDestinationPort(String sourceNodeName, int sourceNodePort) { int destinationNodePort = 0; for (int i = 0; i < connectionsBetweenNodes.Count; i++) { LinksRow checkedRow = connectionsBetweenNodes.ElementAt(i); String nodeName = checkedRow.getSourceNodeName(); int port = checkedRow.getSourceNodePort(); if (sourceNodeName.Equals(nodeName) && port == sourceNodePort) { destinationNodePort = checkedRow.getDestinationNodePort(); } } return(destinationNodePort); }
private static void loadConnectionsBetweenNodes() { StreamReader reader = getFileStreamReader(Config.getProperty("NodeLinksFile")); String textLine = null; String[] parameters = null; String sourceNodeName = null; String sourceNodePort = null; String destinationNodeName = null; String destinationNodePort = null; while ((textLine = reader.ReadLine()) != null) { parameters = textLine.Split(SEPARATOR); sourceNodeName = parameters[SOURCE_NODE_NAME_POSITION]; sourceNodePort = parameters[SOURCE_NODE_PORT_POSITION]; destinationNodeName = parameters[DESTINATION_NODE_NAME_POSITION]; destinationNodePort = parameters[DESTINATION_NODE_PORT_POSITION]; LinksRow row = createLinksRow(sourceNodeName, int.Parse(sourceNodePort), destinationNodeName, int.Parse(destinationNodePort)); connectionsBetweenNodes.Add(row); } }
private static LinksRow createLinksRow(String sourceNodeName, int sourcePort, String destinationNode, int destinationPort) { LinksRow row = new LinksRow(sourceNodeName, sourcePort, destinationNode, destinationPort); return(row); }