Пример #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 override FTree <T> Push_Back(T t)
        {
            int cntbackDig = backDig.digNodes.Count;

            if (backDig.digNodes.Count == 4)
            {
                var newBack = new List <T>(backDig.digNodes);
                newBack.RemoveAt(cntbackDig - 1);

                return(new DeepFTree <T>(frontDig, innerFT.Push_Back(new Node <T>(newBack)), new Digit <T>(backDig.digNodes[cntbackDig - 1], t)));
            }
            else
            {
                var newBack = new List <T>(backDig.digNodes);
                newBack.Add(t);

                return(new DeepFTree <T>(frontDig, innerFT, new Digit <T>(newBack)));
            }
        }