Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Created by SharpDevelop.
- * User: fhrl0
- * Date: 21/08/2020
- * Time: 10:28 p. m.
- * Vertion: 0.5.0
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
- using System;
- using System.Collections.Generic;
- namespace Test{
- /// <summary>
- /// You do the right thing!.
- /// Description of LinkedVector.
- /// </summary>
- public class LinkedVector<T>{
- private T Node;
- private LinkedList<LinkedVector<T>>ListVector;
- public LinkedVector(){
- Constructor(this)
- .Node=default(T);
- }
- public LinkedVector(T Node){
- Constructor(this)
- .Node=Node;
- }
- private LinkedVector<T>Constructor(LinkedVector<T>InitialVector){
- return (this.ListVector=new LinkedList<LinkedVector<T>>())
- .AddFirst(InitialVector)
- .Value;
- }
- public LinkedVector(LinkedList<T>Coordinades){//<-The first coordinate in the list is locked.
- if(!Coordinades.Count.Equals(0)){
- LinkedVector<T>auxiliary=this;
- T Last=Coordinades.Last.Value;
- Coordinades.RemoveLast();
- foreach(T Item in Coordinades){
- auxiliary.Node=Item;
- auxiliary=(auxiliary.ListVector=new LinkedList<LinkedVector<T>>())
- .AddFirst(new LinkedVector<T>()).Value;
- }
- Coordinades.AddLast(auxiliary
- .Node=Last);
- auxiliary.Constructor(this);
- }else{
- Constructor(this)
- .Node=default(T);
- }
- }
- ~LinkedVector(){
- ListVector.Clear();
- ListVector=default(LinkedList<LinkedVector<T>>);//delete
- Node=default(T);//delete
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment