Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        private OpLink GetTreeHigher(OpLink link)
        {
            if (link.LoopRoot != null)
                return link.LoopRoot;

            return link.GetHigher(false);
        }