/** * Find neighbor connections within the range * return ArrayList of List<Connection> for left and right neighbors. */ private Brunet.Collections.Pair <List <Connection>, List <Connection> > GetConnectionInfo(AHAddress t_addr, AHAddress start, AHAddress end, ConnectionList cl) { //this node is within the given range (start_addr, end_addr) List <Connection> left_con_list = new List <Connection>(); List <Connection> right_con_list = new List <Connection>(); foreach (Connection c in cl) { AHAddress adr = (AHAddress)c.Address; //if(adr.IsBetweenFromLeft(t_addr, end) ) { if (InRange(adr, start, t_addr)) { left_con_list.Add(c); } //else if (adr.IsBetweenFromLeft(start, t_addr) ) { else if (InRange(adr, start, t_addr)) { right_con_list.Add(c); } else { //Out of Range. Do nothing! } } //Make a compare and add it to ConnectionTable to sort by Address ConnectionLeftComparer left_cmp = new ConnectionLeftComparer(t_addr); left_con_list.Sort(left_cmp); ConnectionRightComparer right_cmp = new ConnectionRightComparer(t_addr); right_con_list.Sort(right_cmp); Brunet.Collections.Pair <List <Connection>, List <Connection> > ret = new Brunet.Collections.Pair <List <Connection>, List <Connection> >(left_con_list, right_con_list); return(ret); }
/** * Find neighbor connections within the range * return ArrayList of List<Connection> for left and right neighbors. */ private Brunet.Collections.Pair<List<Connection>,List<Connection>> GetConnectionInfo(AHAddress t_addr, AHAddress start, AHAddress end, ConnectionList cl) { //this node is within the given range (start_addr, end_addr) List<Connection> left_con_list = new List<Connection>(); List<Connection> right_con_list = new List<Connection>(); foreach(Connection c in cl) { AHAddress adr = (AHAddress)c.Address; //if(adr.IsBetweenFromLeft(t_addr, end) ) { if (InRange(adr, start, t_addr) ) { left_con_list.Add(c); } //else if (adr.IsBetweenFromLeft(start, t_addr) ) { else if (InRange(adr, start, t_addr) ) { right_con_list.Add(c); } else { //Out of Range. Do nothing! } } //Make a compare and add it to ConnectionTable to sort by Address ConnectionLeftComparer left_cmp = new ConnectionLeftComparer(t_addr); left_con_list.Sort(left_cmp); ConnectionRightComparer right_cmp = new ConnectionRightComparer(t_addr); right_con_list.Sort(right_cmp); Brunet.Collections.Pair<List<Connection>,List<Connection>> ret = new Brunet.Collections.Pair<List<Connection>,List<Connection>>(left_con_list, right_con_list); return ret; }