public override View <WeightedElement <T>, double> LeftView() { var internLView = _finger.LeftView(); internLView.Rest = new PriorityQueue <T>(internLView.Rest); return(internLView); }
public override View <SizedElement <T>, int> LeftView() { var v = _finger.LeftView(); v.Rest = new FingerArray <T>(v.Rest); return(v); }
OrderedSequence <T, V> PushLeft(OrderedElement <T, V> o) { var v = _finger.LeftView(); if (v != null) { if (v.End.Measure().CompareTo(o.Measure()) < 0) { throw new Exception("OrderedSequence Error: PushLeft() of an element greater than the smallest seq el."); } } return(new OrderedSequence <T, V>(_x, _finger.PushLeft(o))); }
static FingerTree <OrderedElement <T, V>, V> Merge(FingerTree <OrderedElement <T, V>, V> f, FingerTree <OrderedElement <T, V>, V> g) { var v = g.LeftView(); if (v == null) { return(f); } var end = v.End; var rest = v.Rest; var fsplit = f.Split(((Func <V, V, bool>)LessThanOrEqual).Curry(end.Measure())); var fleft = fsplit.Left; var fright = fsplit.Right; var merged = Merge(rest, fright); return(fleft.Merge(merged.PushLeft(end))); }