public List <MobileNode> GetNodesWithinRange(SimulationEnvironment env) { List <MobileNode> nodes = new List <MobileNode>(); foreach (MobileNode node in env.GetNodes()) { if (IsWithinRangeOf(node) && !node.Equals(this)) { nodes.Add(node); } } return(nodes); }
public void PrintNodesWithinRange(SimulationEnvironment env) { foreach (MobileNode n in env.GetNodes()) { if (!this.Equals(n)) { if (IsWithinRangeOf(n)) { new OutputPaneController().PrintToOutputPane("Node_Range", "Node " + n.GetNodeID() + " is within range. Distance: " + GetDistance(n)); } else { new OutputPaneController().PrintToOutputPane("Node_Range", "Node " + n.GetNodeID() + " is not within range. Distance: " + GetDistance(n)); } } } }