コード例 #1
0
 public PCSTreeReverseIterator(GameObject rootNode)
 {
     Debug.Assert(rootNode != null);
     this.root    = rootNode;
     this.current = this.root;
     PCSTreeIterator.CalculateIterators(rootNode);
 }
コード例 #2
0
        private static GameObject privGetNext(GameObject node, bool UseChild = true)
        {
            GameObject tmp = null;

            Debug.Assert(node != null);

            if ((node.pChild != null) && UseChild)
            {
                tmp = (GameObject)node.pChild;
            }
            else if (node.pSibling != null)
            {
                tmp = (GameObject)node.pSibling;
            }
            else if (node.pParent != PCSTreeIterator.pRoot && node.pParent != PCSTreeIterator.pWrongParent)
            {
                // recurse here
                tmp = PCSTreeIterator.privGetNext((GameObject)node.pParent, false);
            }
            else
            {
                tmp = null;
            }
            return(tmp);
        }
コード例 #3
0
        public static void CalculateIterators(GameObject pRootNode)
        {
            // FIX Todo have this backed into PCSTree

            Debug.Assert(pRootNode != null);
            PCSTreeIterator.pRoot        = pRootNode;
            PCSTreeIterator.pWrongParent = (GameObject)pRootNode.pParent;

            PCSTreeIterator.pCurrent = PCSTreeIterator.pRoot;

            GameObject pPrevGameObj = (GameObject)pRootNode;
            // Initialize the reserve pointer
            GameObject pGameObj = (GameObject)pRootNode;


            while (pGameObj != null)
            {
                // fill the basis
                pPrevGameObj = pGameObj;

                // Advance
                pGameObj = PCSTreeIterator.privSecretNext();
                pPrevGameObj.pForward = pGameObj;

                if (pGameObj != null)
                {
                    pGameObj.pReverse = pPrevGameObj;
                }
            }


            //    pRootNode.pForward.pReverse = pRootNode;
            pRootNode.pReverse = pPrevGameObj;
        }
コード例 #4
0
        public static void CalculateIterators(GameObject pRootNode)
        {
            Debug.Assert(pRootNode != null);
            PCSTreeIterator.root        = pRootNode;
            PCSTreeIterator.wrongParent = (GameObject)pRootNode.pParent;
            PCSTreeIterator.current     = PCSTreeIterator.root;
            GameObject pPrevGameObj = (GameObject)pRootNode;
            GameObject pGameObj     = (GameObject)pRootNode;

            while (pGameObj != null)
            {
                pPrevGameObj          = pGameObj;
                pGameObj              = PCSTreeIterator.privSecretNext();
                pPrevGameObj.pForward = pGameObj;
                if (pGameObj != null)
                {
                    pGameObj.pReverse = pPrevGameObj;
                }
            }
            pRootNode.pReverse = pPrevGameObj;
        }
コード例 #5
0
        public static void CalculateIterators(GameObject pRootNode)
        {
            // FIX Todo have this backed into PCSTree

            Debug.Assert(pRootNode != null);
            PCSTreeIterator.pRoot        = pRootNode;
            PCSTreeIterator.pWrongParent = (GameObject)pRootNode.pParent;
            PCSTreeIterator.pCurrent     = PCSTreeIterator.pRoot;

            GameObject pPrevGameObj = (GameObject)pRootNode;
            // Initialize the reserve pointer
            GameObject pGameObj = (GameObject)pRootNode;

            //iterate through
            while (pGameObj != null)
            {
                // fill the basis
                pPrevGameObj = pGameObj;

                // Advance
                pGameObj = PCSTreeIterator.privSecretNext();
                //set the forward path
                pPrevGameObj.pForward = pGameObj;

                //if there is no next, at end of list
                if (pGameObj != null)
                {
                    //set the reverse path
                    pGameObj.pReverse = pPrevGameObj;
                }
            }

            ////Todo check on forward or reverse iterator for Calculating Iterators in PCSTreeIterators
            //pRootNode.pForward.pReverse = pRootNode;
            pRootNode.pReverse = pPrevGameObj;
        }