예제 #1
0
 void SetCurrent(object v)
 {
     _current = (Leaf <TValue>)v;
 }
예제 #2
0
 public override FTree <TChild> Update(int index, Leaf <TValue> leaf, Lineage lineage)
 {
     return(new Single(CenterDigit.Update(index, leaf, lineage), lineage));
 }
예제 #3
0
 public Enumerator(Leaf node, bool forward, int startIndex = 0)
 {
     _node    = node;
     _forward = forward;
     _index   = startIndex - 1;
 }
예제 #4
0
파일: FTree.cs 프로젝트: stjordanis/Imms
			public abstract FTree<TChild> Insert(int index, Leaf<TValue> leaf, Lineage lineage);
예제 #5
0
파일: FTree.cs 프로젝트: stjordanis/Imms
			public abstract FTree<TChild> Update(int index, Leaf<TValue> leaf, Lineage lineage);
예제 #6
0
 public override void Fuse(Leaf <TValue> after, out Leaf <TValue> firstRes, out Leaf <TValue> lastRes, Lineage lineage)
 {
     throw ImplErrors.Invalid_invocation("FingerTree Leaf");
 }
예제 #7
0
 public override void Insert(int index, Leaf <TValue> leaf, out Leaf <TValue> leftmost, out Leaf <TValue> rightmost,
                             Lineage lineage)
 {
     leftmost  = leaf;
     rightmost = this;
 }
예제 #8
0
 public bool Equals(Leaf <TValue> other)
 {
     return(Value.Equals(other.Value));
 }
예제 #9
0
 public override Leaf <TValue> Update(int index, Leaf <TValue> leaf, Lineage lineage)
 {
     return(leaf);
 }
예제 #10
0
 public abstract TObject Update(int index, Leaf <TValue> leaf, Lineage lineage);
예제 #11
0
 /// <summary>
 ///     Inserts the leaf at the specified index, returning the primary result in 'value' and a rightmost overflow result in
 ///     'rightmost'
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="leaf">The leaf.</param>
 /// <param name="value">The primary result digit. Cannot be null.</param>
 /// <param name="rightmost1">The rightmost overflow result, when the digit cannot contain the new leaf. May be null.</param>
 /// <param name="lineage">The lineage.</param>
 public abstract void Insert(int index, Leaf <TValue> leaf, out TObject value, out TObject rightmost1, Lineage lineage);
예제 #12
0
                public override void Insert(int index, Leaf <TValue> leaf, out Digit leftmost, out Digit rightmost, Lineage lineage)
                {
#if ASSERTS
                    leaf.AssertNotNull();
#endif

                    var    whereIsThisIndex = WhereIsThisIndex(index);
                    TChild myLeftmost;
                    TChild myRightmost;
                    leftmost  = null;
                    rightmost = null;
                    switch (whereIsThisIndex)
                    {
                    case IN_START:
                    case IN_MIDDLE_OF_1:
                        First.Insert(index, leaf, out myLeftmost, out myRightmost, lineage);
                        if (Size == 4 && myRightmost != null)
                        {
                            leftmost  = new Digit(myLeftmost, myRightmost, Second, lineage);
                            rightmost = MutateOrCreate(Third, Fourth, lineage);
                            return;
                        }
                        leftmost = myRightmost != null
                                                                ? CreateCheckNull(lineage, myLeftmost, myRightmost, Second, Third)
                                                                : CreateCheckNull(lineage, myLeftmost, Second, Third, Fourth);

                        rightmost = null;
                        return;

                    case IN_START_OF_2:
                    case IN_MIDDLE_OF_2:
                        Second.Insert(index - First.Measure, leaf, out myLeftmost, out myRightmost, lineage);
                        if (Size == 4 && myRightmost != null)
                        {
                            leftmost  = new Digit(First, myLeftmost, myRightmost, lineage);
                            rightmost = MutateOrCreate(Third, Fourth, lineage);
                            return;
                        }
                        leftmost = myRightmost != null
                                                                ? CreateCheckNull(lineage, First, myLeftmost, myRightmost, Third)
                                                                : CreateCheckNull(lineage, First, myLeftmost, Third, Fourth);

                        rightmost = null;
                        return;

                    case IN_START_OF_3:
                    case IN_MIDDLE_OF_3:
                        Third.Insert(index - First.Measure - Second.Measure, leaf, out myLeftmost, out myRightmost, lineage);
                        if (Size == 4 && myRightmost != null)
                        {
                            leftmost  = new Digit(First, Second, myLeftmost, lineage);
                            rightmost = MutateOrCreate(myRightmost, Fourth, lineage);
                            return;
                        }
                        leftmost =
                            myRightmost != null
                                                                        ? CreateCheckNull(lineage, First, Second, myLeftmost, myRightmost)
                                                                        : CreateCheckNull(lineage, First, Second, myLeftmost, Fourth);

                        rightmost = null;
                        return;

                    case IN_START_OF_4:
                    case IN_MIDDLE_OF_4:
                        Fourth.Insert(index - Measure + Fourth.Measure, leaf, out myLeftmost, out myRightmost, lineage);
                        if (Size == 4 && myRightmost != null)
                        {
                            leftmost  = new Digit(First, Second, Third, lineage);
                            rightmost = MutateOrCreate(myLeftmost, myRightmost, lineage);
                            return;
                        }
                        leftmost  = MutateOrCreate(First, Second, Third, myLeftmost, lineage);
                        rightmost = null;
                        return;

                    default:
                        throw ImplErrors.Invalid_execution_path("");
                    }
                }