Ejemplo n.º 1
0
 public override void Promote(FrugalListBase <T> oldList)
 {
     if (1 != oldList.Count)
     {
         throw new ArgumentException("oldList");
     }
     this.SetCount(1);
     this.SetAt(0, oldList.EntryAt(0));
 }
Ejemplo n.º 2
0
 public override void Promote(FrugalListBase <T> oldList)
 {
     for (int i = 0; i < oldList.Count; i++)
     {
         if (this.Add(oldList.EntryAt(i)) != FrugalListStoreState.Success)
         {
             throw new ArgumentException("list is smaller than oldList", "oldList");
         }
     }
 }
Ejemplo n.º 3
0
        public override void Promote(FrugalListBase <T> oldList)
        {
            int count = oldList.Count;

            if (3 < count)
            {
                throw new ArgumentException("oldList");
            }
            this.SetCount(oldList.Count);
            switch (count)
            {
            case 0:
            {
                return;
            }

            case 1:
            {
                this.SetAt(0, oldList.EntryAt(0));
                return;
            }

            case 2:
            {
                this.SetAt(0, oldList.EntryAt(0));
                this.SetAt(1, oldList.EntryAt(1));
                return;
            }

            case 3:
            {
                this.SetAt(0, oldList.EntryAt(0));
                this.SetAt(1, oldList.EntryAt(1));
                this.SetAt(2, oldList.EntryAt(2));
                return;
            }
            }
            throw new ArgumentOutOfRangeException("index");
        }