示例#1
0
        public override FTree <T> App2(List <T> ts, FTree <T> rightFT)
        {
            if (!(rightFT is DeepFTree <T>))
            {
                FTree <T> resultFT = this;

                foreach (T t in ts)
                {
                    resultFT = resultFT.Push_Back(t);
                }

                return((rightFT is EmptyFTree <T>)
                          ? resultFT
                          : resultFT.Push_Back(rightFT.LeftView().head));
            }
            else
            {
                var deepRight = rightFT as DeepFTree <T>;
                var cmbList   = new List <T>(backDig.digNodes);

                cmbList.AddRange(ts);
                cmbList.AddRange(deepRight.frontDig.digNodes);

                return(new DeepFTree <T>(frontDig, innerFT.App2(FTree <T> .ListOfNodes(cmbList), deepRight.innerFT), deepRight.backDig));
            }
        }
示例#2
0
        public static FTree <T> Create(List <T> frontList, FTree <Node <T> > innerFT, Digit <T> backDig)
        {
            if (frontList.Count > 0)
            {
                return(new DeepFTree <T>(new Digit <T>(frontList), innerFT, backDig));
            }

            if (innerFT is EmptyFTree <Node <T> > )
            {
                return(FromSequence(backDig.digNodes));
            }

            var innerLeft   = innerFT.LeftView();
            var newlstFront = innerLeft.head.theNodes;

            return(new DeepFTree <T>(new Digit <T>(newlstFront), innerLeft.ftTail, backDig));
        }