private OpLink TraverseUp(OpLink link, int distance) { // needs to get unconfiremd ids so unconfirmed above / below are updated with link status if (distance == 0) return link; int traverse = 0; OpLink uplink = link.GetHigher(false); while (uplink != null) { traverse++; if (traverse == distance) return uplink; uplink = uplink.GetHigher(false); } return null; }
public bool IsLooped(OpLink local) { // this function is the same as getUplinkIDs with minor mods List<ulong> list = new List<ulong>(); OpLink uplink = local.GetHigher(false); while (uplink != null) { // if loop lead back to self, link is in loop if (uplink == local) return true; // if there is a loop higher up, but link is not in it, return if (list.Contains(uplink.UserID)) return false; list.Add(uplink.UserID); uplink = uplink.GetHigher(false); } return false; }
private OpLink GetTreeHigher(OpLink link) { if (link.LoopRoot != null) return link.LoopRoot; return link.GetHigher(false); }