OrdMerge(FTreeM <OrdElem <T, V>, V> ordTree1, FTreeM <OrdElem <T, V>, V> ordTree2 ) { ViewL <OrdElem <T, V>, V> lView2 = ordTree2.LeftView(); if (lView2 == null) { return(ordTree1); } //else OrdElem <T, V> bHead = lView2.head; FTreeM <OrdElem <T, V>, V> bTail = lView2.ftTail; // Split ordTree1 on elems <= and then > bHead Pair <FTreeM <OrdElem <T, V>, V>, FTreeM <OrdElem <T, V>, V> > tree1Split = ordTree1.SeqSplit (new MPredicate <V> (FP.Curry <V, V, bool> (theLEMethod2, bHead.Measure())) ); FTreeM <OrdElem <T, V>, V> leftTree1 = tree1Split.first; FTreeM <OrdElem <T, V>, V> rightTree1 = tree1Split.second; // OrdMerge the tail of ordTree2 // with the right-split part of ordTree1 FTreeM <OrdElem <T, V>, V> mergedRightparts = OrdMerge(bTail, rightTree1); return(leftTree1.Merge(mergedRightparts.Push_Front(bHead))); }
public override ViewL <CompElem <T>, double> LeftView() { ViewL <CompElem <T>, double> internLView = treeRep.LeftView(); internLView.ftTail = new PriorityQueue <T>(internLView.ftTail); return(internLView); }
public override ViewL <SizedElement <T>, uint> LeftView() { ViewL <SizedElement <T>, uint> internLView = treeRep.LeftView(); internLView.ftTail = new Seq <T>(internLView.ftTail); return(internLView); }
public override IEnumerable <T> ToSequence() { ViewL <T> lView = LeftView(); yield return(lView.head); foreach (T t in lView.ftTail.ToSequence()) { yield return(t); } }