FHRL

LinkedVector 0.5.0(Bug)

Aug 24th, 2020 (edited)
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. /*
  2.  * Created by SharpDevelop.
  3.  * User: fhrl0
  4.  * Date: 21/08/2020
  5.  * Time: 10:28 p. m.
  6.  * Vertion: 0.5.0
  7.  * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8.  */
  9. using System;
  10. using System.Collections.Generic;
  11.  
  12. namespace Test{
  13.     /// <summary>
  14.     /// You do the right thing!.
  15.     /// Description of LinkedVector.
  16.     /// </summary>
  17.     public class LinkedVector<T>{
  18.         private T Node;
  19.         private LinkedList<LinkedVector<T>>ListVector;
  20.         public LinkedVector(){
  21.             Constructor(this)
  22.             .Node=default(T);
  23.         }
  24.         public LinkedVector(T Node){
  25.             Constructor(this)
  26.             .Node=Node;
  27.         }
  28.         private LinkedVector<T>Constructor(LinkedVector<T>InitialVector){
  29.             return (this.ListVector=new LinkedList<LinkedVector<T>>())
  30.                         .AddFirst(InitialVector)
  31.                         .Value;
  32.         }
  33.         public LinkedVector(LinkedList<T>Coordinades){//<-The first coordinate in the list is locked.
  34.             if(!Coordinades.Count.Equals(0)){
  35.                 LinkedVector<T>auxiliary=this;
  36.                 T Last=Coordinades.Last.Value;
  37.                
  38.                 Coordinades.RemoveLast();
  39.                 foreach(T Item in Coordinades){
  40.                     auxiliary.Node=Item;
  41.                     auxiliary=(auxiliary.ListVector=new LinkedList<LinkedVector<T>>())
  42.                                         .AddFirst(new LinkedVector<T>()).Value;
  43.                 }
  44.                 Coordinades.AddLast(auxiliary
  45.                            .Node=Last);
  46.                 auxiliary.Constructor(this);
  47.                
  48.             }else{
  49.                 Constructor(this)
  50.                 .Node=default(T);
  51.             }
  52.         }
  53.         ~LinkedVector(){
  54.             ListVector.Clear();
  55.             ListVector=default(LinkedList<LinkedVector<T>>);//delete
  56.             Node=default(T);//delete
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment