public OrderedSequence <T, V> DeleteAll(T t) { V vK = KeyObj.KeyAssign(t); // the Key of t Pair <OrderedSequence <T, V>, OrderedSequence <T, V> > tPart = Partition(vK); OrderedSequence <T, V> seqPrecedestheEl = tPart.first; OrderedSequence <T, V> seqStartsWiththeEl = tPart.second; Pair <FTreeM <OrdElem <T, V>, V>, FTreeM <OrdElem <T, V>, V> > lastTreeSplit = seqStartsWiththeEl.treeRep.SeqSplit (new MPredicate <V> (FP.Curry <V, V, bool> (theLTMethod2, vK) ) ); //OrderedSequence<T, V> seqBeyondtheEl = // new OrderedSequence<T, V>(KeyObj, lastTreeSplit.second); return(new OrderedSequence <T, V> (KeyObj, seqPrecedestheEl.treeRep.Merge(lastTreeSplit.second) )); }
public OrderedSequence <T, V> Merge(OrderedSequence <T, V> ordSeq2) { FTreeM <OrdElem <T, V>, V> theMergedTree = OrdMerge(treeRep, ordSeq2.treeRep); return(new OrderedSequence <T, V> (KeyObj, theMergedTree)); }
// Constructor 2 public OrderedSequence(Key <T, V> KeyObj, IEnumerable <T> aList) { this.KeyObj = KeyObj; OrderedSequence <T, V> tempSeq = new OrderedSequence <T, V>(KeyObj); treeRep = new EmptyFTreeM <OrdElem <T, V>, V>(new KeyMonoid <T, V>(KeyObj).theMonoid); foreach (T t in aList) { tempSeq = tempSeq.Push_Back(new OrdElem <T, V>(t, KeyObj)); } treeRep = tempSeq.treeRep; }
Partition(V vK) { Pair <FTreeM <OrdElem <T, V>, V>, FTreeM <OrdElem <T, V>, V> > baseSeqSplit = treeRep.SeqSplit(new MPredicate <V> (FP.Curry <V, V, bool> (theLEMethod2, vK) ) ); OrderedSequence <T, V> left = new OrderedSequence <T, V>(KeyObj, baseSeqSplit.first); OrderedSequence <T, V> right = new OrderedSequence <T, V>(KeyObj, baseSeqSplit.second); return(new Pair <OrderedSequence <T, V>, OrderedSequence <T, V> > (left, right)); }