private static void WillTest() { //Egna tester. Operatorer Position pos1 = new Position(47, 14); Position pos2 = new Position(10, 18); Position pos3 = new Position(80, 64); Position pos4 = new Position(12, 5); Position pos5 = new Position(52, 14); Position pos6 = new Position(90, 14); Position pos7 = new Position(10, 18); Position pos8 = new Position(80, 64); Position pos9 = new Position(122, 5); Position pos10 = new Position(13, 14); SortedPosList list = new SortedPosList(); list.Add(pos1); list.Add(pos2); list.Add(pos3); list.Add(pos4); list.Add(pos5); SortedPosList list2 = new SortedPosList(); list2.Add(pos6); list2.Add(pos7); list2.Add(pos8); list2.Add(pos9); list2.Add(pos10); SortedPosList list3 = list - list2; SortedPosList list4 = list2 + list; list.Remove(new Position(80, 64)); list.Remove(new Position(10, 10)); list.Remove(new Position(10, 11)); // skriver ut list - list2 Console.WriteLine("list - list2 : "); for (int i = 0; i < list3.Count(); i++) { Console.WriteLine(list3[i].ToString() + ". Length: " + list3[i].Length()); } // skriver ut list2 + list Console.WriteLine("list2 + list : "); for (int i = 0; i < list4.Count(); i++) { Console.WriteLine(list4[i].ToString() + ". Length list 2 : " + list4[i].Length()); } }
private static void test() { //Första testet från ITHS Console.WriteLine(new Position(2, 4) + new Position(1, 2) + "\n"); Console.WriteLine(new Position(2, 4) - new Position(1, 2) + "\n"); Console.WriteLine(new Position(1, 2) - new Position(3, 6) + "\n"); Console.WriteLine(new Position(3, 5) % new Position(1, 3) + "\n"); SortedPosList list1 = new SortedPosList(); SortedPosList list2 = new SortedPosList(); list1.Add(new Position(3, 7)); list1.Add(new Position(1, 4)); list1.Add(new Position(2, 6)); list1.Add(new Position(2, 3)); Console.WriteLine(list1 + "\n"); list1.Remove(new Position(2, 6)); Console.WriteLine(list1 + "\n"); list2.Add(new Position(3, 7)); list2.Add(new Position(1, 2)); list2.Add(new Position(3, 6)); list2.Add(new Position(2, 3)); Console.WriteLine((list2 + list1) + "\n"); SortedPosList circleList = new SortedPosList(); circleList.Add(new Position(1, 1)); circleList.Add(new Position(2, 2)); circleList.Add(new Position(3, 3)); Console.WriteLine(circleList.CircleContent(new Position(5, 5), 4) + "\n"); }
public static SortedPosList operator -(SortedPosList sp1, SortedPosList sp2) { SortedPosList newList = sp1.Clone(); int i = 0; int j = 0; while (i < sp1.Count() && j < sp2.Count()) { if (sp1[i].Equals(sp2[j])) { newList.Remove(sp1[i]); i++; j++; } else if (sp1[i] < sp2[j]) { i++; } else if (sp1[i] > sp2[j]) { j++; } } return(newList); }
public static SortedPosList operator -(SortedPosList a, SortedPosList b) { int clonedIndex = 0; int bIndex = 0; SortedPosList clonedList = a.Clone(); while (clonedIndex < clonedList.Count() && bIndex < b.Count()) { if (clonedList[clonedIndex].Equals(b[bIndex])) { clonedList.Remove(clonedList[clonedIndex]); } else { if (clonedList[clonedIndex].Length() >= b[bIndex].Length()) { bIndex++; } else { clonedIndex++; } } } return(clonedList); }
public static SortedPosList operator -(SortedPosList sp1, SortedPosList sp2) { SortedPosList clone = sp1.SortedPosListClone(); int i = 0, j = 0; while (i < sp1.Count() && j < sp2.Count()) { if (sp1.positions[i].Equals(sp2.positions[j])) { clone.Remove(sp1.positions[i]); i++; j++; } else if (sp1.positions[i] < sp2.positions[j]) { i++; } else { j++; } } return(clone); }
public static void Main(string[] args) { Console.WriteLine(new Position(2, 4) + new Position(1, 2) + "\n"); Console.WriteLine(new Position(2, 4) - new Position(1, 2) + "\n"); Console.WriteLine(new Position(1, 2) - new Position(3, 6) + "\n"); Console.WriteLine(new Position(3, 5) % new Position(1, 3) + "\n"); SortedPosList list1 = new SortedPosList(); SortedPosList list2 = new SortedPosList(); list1.Add(new Position(3, 7)); list1.Add(new Position(1, 4)); list1.Add(new Position(2, 6)); list1.Add(new Position(2, 3)); Console.WriteLine(list1 + "\n"); list1.Remove(new Position(2, 6)); Console.WriteLine(list1 + "\n"); list2.Add(new Position(3, 7)); list2.Add(new Position(1, 2)); list2.Add(new Position(3, 6)); list2.Add(new Position(2, 3)); Console.WriteLine((list2 + list1) + "\n"); SortedPosList circleList = new SortedPosList(); circleList.Add(new Position(1, 1)); circleList.Add(new Position(2, 2)); circleList.Add(new Position(3, 3)); Console.WriteLine(circleList.CircleContent(new Position(5, 5), 4) + "\n"); }
public static SortedPosList operator *(SortedPosList a, SortedPosList b) { SortedPosList result = a.Clone(); for (int i = 0; i < b.Count(); i++) { result.Remove(b[i]); } return(result); }
public static void Main(string[] args) { Console.WriteLine(new Position(2, 4) + new Position(1, 2) + "\n"); Console.WriteLine(new Position(2, 4) - new Position(1, 2) + "\n"); Console.WriteLine(new Position(1, 2) - new Position(3, 6) + "\n"); Console.WriteLine(new Position(3, 5) % new Position(1, 3) + "\n"); SortedPosList list1 = new SortedPosList(); SortedPosList list2 = new SortedPosList(); list1.Add(new Position(3, 7)); list1.Add(new Position(1, 4)); list1.Add(new Position(2, 6)); list1.Add(new Position(2, 3)); Console.WriteLine(list1 + "\n"); list1.Remove(new Position(2, 6)); Console.WriteLine(list1 + "\n"); list2.Add(new Position(3, 7)); list2.Add(new Position(1, 2)); list2.Add(new Position(3, 6)); list2.Add(new Position(2, 3)); Console.WriteLine((list2 + list1) + "\n"); SortedPosList circleList = new SortedPosList(); circleList.Add(new Position(1, 1)); circleList.Add(new Position(2, 2)); circleList.Add(new Position(3, 3)); Console.WriteLine(circleList.CircleContent(new Position(5, 5), 4) + "\n"); SortedPosList A = new SortedPosList(); A.Add(new Position(3, 7)); A.Add(new Position(1, 4)); A.Add(new Position(2, 6)); A.Add(new Position(2, 3)); SortedPosList B = new SortedPosList(); B.Add(new Position(3, 7)); B.Add(new Position(1, 2)); B.Add(new Position(3, 6)); B.Add(new Position(2, 3)); B.Add(new Position(22, 3)); B.Add(new Position(24, 3)); Console.WriteLine($"A-listan innehåller punkterna: {A}"); Console.WriteLine($"B-listan innehåller {B}"); Console.WriteLine($"A-B blir: {A-B}"); Console.WriteLine($"B-A blir: {B - A}"); }
public SortedPosList CircleContent(Position centerPos, double radius) { SortedPosList cloneList = Clone(); foreach (var pos in PosList) { if ((Math.Pow(pos.X - centerPos.X, 2) + Math.Pow(pos.Y - centerPos.Y, 2)) > Math.Pow(radius, 2)) { cloneList.Remove(pos); } } return(cloneList); }
public SortedPosList CircleContent(Position centerPos, double radius) { SortedPosList newCircleList = Clone(); foreach (var pos in positionList) { if (Math.Pow(pos.xPos - centerPos.xPos, 2) + Math.Pow(pos.yPos - centerPos.yPos, 2) > Math.Pow(radius, 2)) { newCircleList.Remove(pos); } } return(newCircleList); }
public SortedPosList CircleContent(Position centerPos, double radius) { SortedPosList clone = SortedPosListClone(); for (int i = 0; i < clone.Count(); i++) { if (centerPos % clone.positions[i] > radius) { clone.Remove(clone.positions[i]); i--; } } return(clone); }
public static SortedPosList operator -(SortedPosList posList1, SortedPosList posList2) { SortedPosList instance = posList1.Clone(); foreach (Position p in posList2.posList) { if (instance.posList.Contains(p)) { instance.Remove(p); } } return(instance); }
public static SortedPosList operator *(SortedPosList sp1, SortedPosList sp2) { SortedPosList dublettList = sp1.Clone(); for (int i = 0; i < sp1.Count(); i++) { for (int j = 0; j < sp2.Count(); j++) { if (sp1.positionList[i].Equals(sp2.positionList[j])) { dublettList.Remove(sp1.positionList[i]); } } } return(dublettList); }
public static void RunVGTests() { // Testing the subtraction-operator of SortedPosLists SortedPosList listA = new SortedPosList(); SortedPosList listB = new SortedPosList(); listA.Add(new Position(0.5, 0.5)); listA.Add(new Position(1, 4)); listA.Add(new Position(4.5, 0)); listB.Add(new Position(1, 4)); listB.Add(new Position(12, 5.6)); SortedPosList listC = listA * listB; SortedPosList listD = listB * listA; // listC should be: {(0.5, 0.5), (4.5, 0)} Console.Write("List C: " + listC + "\n"); // listD should be: {(12, 5.6)} Console.Write("List D: " + listD + "\n"); // Testing construction of SortedPosList with path-variable and Saving/Loading string path1 = "list.txt"; string path2 = "list2.txt"; SortedPosList listFromPath1 = new SortedPosList(path1); listFromPath1.Add(new Position(2.3, 3.3)); listFromPath1.Add(new Position(3.5, 8)); // The new List should load from path1 and be the same as listFromPath1: // {(2.3, 3.3), (3.5, 8)} Console.Write("New list reading from path1: " + new SortedPosList(path1) + "\n"); SortedPosList listFromPath2 = new SortedPosList(path2); listFromPath2.Add(new Position(2.1, 1.2)); listFromPath2.Add(new Position(0, 100)); listFromPath2.Remove(new Position(2.1, 1.2)); // The new List should load from path2 and be the same as listFromPath2: // {(0, 100)} Console.Write("New list reading from path2: " + new SortedPosList(path2) + "\n"); }
// Returns a new sorted list containing all positions that aren't shared // between the two provided lists // sp1 - the first sorted list of Positions // sp2 - the second sorted list of Positions public static SortedPosList operator -(SortedPosList list1, SortedPosList list2) { SortedPosList comboList = list1 + list2; SortedPosList result = list1.Clone(); for (int i = 0; i + 1 < comboList.Count(); i++) { if (comboList[i].Equals(comboList[i + 1])) { //Console.WriteLine($"Found same values: {comboList[i]} and {comboList[i + 1]}"); result.Remove(comboList[i]); } else { // Console.WriteLine($"Not The same: {comboList[i]} and {comboList[i + 1]}"); } } return(result); }
//Tests private static void pathTest() { // Testing a list connected to a path. // Save / Load / Parse method tested SortedPosList listWithPath = new SortedPosList(@"c:\users\willi\Documents\test.txt"); Position posM = new Position(123, 37); Position posN = new Position(14, 55); Position posK = new Position(3, 69); listWithPath.Add(posM); listWithPath.Add(posN); listWithPath.Add(posK); Console.WriteLine("List with path: "); for (int i = 0; i < listWithPath.Count(); i++) { Console.WriteLine(listWithPath[i].ToString()); } listWithPath.Remove(posM); Console.WriteLine("List with path after remove: "); for (int i = 0; i < listWithPath.Count(); i++) { Console.WriteLine(listWithPath[i].ToString()); } //List without path set SortedPosList withoutPath = new SortedPosList(); Position poss = new Position(100, 100); withoutPath.Add(new Position(110, 900)); withoutPath.Add(new Position(50, 10)); withoutPath.Add(poss); withoutPath.Remove(poss); Console.WriteLine("Without Path: "); //Should return a list of 2. 3 added and 1 removed for (int i = 0; i < withoutPath.Count(); i++) { Console.WriteLine(withoutPath[i].ToString()); } }
static void Main(string[] args) { Console.WriteLine(new Position(2, 4) + new Position(1, 2) + "\n"); Console.WriteLine(new Position(2, 4) - new Position(1, 2) + "\n"); Console.WriteLine(new Position(1, 2) - new Position(3, 6) + "\n"); Console.WriteLine(new Position(3, 5) % new Position(1, 3) + "\n"); SortedPosList list1 = new SortedPosList(); SortedPosList list2 = new SortedPosList(); list1.Add(new Position(3, 7)); list1.Add(new Position(1, 4)); list1.Add(new Position(2, 6)); list1.Add(new Position(2, 3)); Console.WriteLine("list 1 index of 1,2,3: " + list1[0] + ", " + list1[1] + ", " + list1[2] + "\n"); list1.Remove(new Position(2, 6)); Console.WriteLine("updated list1: " + list1 + "\n"); list2.Add(new Position(3, 7)); list2.Add(new Position(1, 2)); list2.Add(new Position(3, 6)); list2.Add(new Position(2, 3)); Console.WriteLine("list2: " + list2 + "\n"); Console.WriteLine("added lists: " + (list2 + list1) + "\n"); SortedPosList circleList = new SortedPosList(); circleList.Add(new Position(1, 1)); circleList.Add(new Position(2, 2)); circleList.Add(new Position(3, 3)); Console.WriteLine("in circle: " + circleList.CircleContent(new Position(5, 5), 4) + "\n"); //VG SortedPosList AList = new SortedPosList(); AList.Add(new Position(3, 7)); AList.Add(new Position(1, 4)); AList.Add(new Position(2, 6)); AList.Add(new Position(2, 3)); SortedPosList BList = new SortedPosList(); BList.Add(new Position(3, 7)); BList.Add(new Position(1, 2)); BList.Add(new Position(3, 6)); BList.Add(new Position(2, 3)); //testar att lägga ta bort alla förekommande positioner ifrån den första listan Console.WriteLine("a - b lists: " + (AList * BList) + "\n"); Console.WriteLine("b - a lists: " + (BList * AList) + "\n"); string testPath = @"/Users/dev/Documents/C# grunder/Labb2/Labb2/Data.txt"; //testar att spara till filen BList.Save(testPath); Console.WriteLine("saved: " + BList); //laddar in blistan ifrån filen SortedPosList listFromFile = new SortedPosList(testPath); Console.WriteLine("from file: " + listFromFile); //updaterar filen med det nya värdet listFromFile.Add(new Position(8, 8)); //skriver ut innehålle ifrån filen listFromFile = new SortedPosList(testPath); Console.WriteLine("updated file: " + listFromFile); }
static void Main(string[] args) { /* * //Creates two positions and uses + on them. Returns a new position with added values from both. * Console.WriteLine(new Position(2, 4) + new Position(1, 2) + "\n"); * * //Creates two positions and uses - on them. Returns a new position with subtracted values from both. Cannot be negative tho. * Console.WriteLine(new Position(2, 4) - new Position(1, 2) + "\n"); * * //Creates two positions and uses - on them. Returns a new position with subtracted values from both. Cannot be negative tho. * Console.WriteLine(new Position(1, 2) - new Position(3, 6) + "\n"); * * //Creates two positions and uses % on them. Returns the length between them. * Console.WriteLine(new Position(3, 5) % new Position(1, 3) + "\n"); * * SortedPosList list1 = new SortedPosList(); * SortedPosList list2 = new SortedPosList(); * list1.Add(new Position(3, 7)); * list1.Add(new Position(1, 4)); * list1.Add(new Position(2, 6)); * list1.Add(new Position(2, 3)); * Console.WriteLine(list1 + "\n"); * list1.Remove(new Position(2, 6)); * Console.WriteLine(list1 + "\n"); * * list2.Add(new Position(3, 7)); * list2.Add(new Position(1, 2)); * list2.Add(new Position(3, 6)); * list2.Add(new Position(2, 3)); * Console.WriteLine((list2 + list1) + "\n"); * * SortedPosList circleList = new SortedPosList(); * circleList.Add(new Position(1, 1)); * circleList.Add(new Position(2, 2)); * circleList.Add(new Position(3, 3)); * Console.WriteLine(circleList.CircleContent(new Position(5, 5), 4) + "\n"); */ /* * SortedPosList list1 = new SortedPosList(); * SortedPosList list2 = new SortedPosList(); * list1.Add(new Position(3, 7)); * list1.Add(new Position(1, 4)); * list1.Add(new Position(2, 6)); * list1.Add(new Position(2, 3)); * * list2.Add(new Position(3, 7)); * list2.Add(new Position(1, 2)); * list2.Add(new Position(3, 6)); * list2.Add(new Position(2, 3)); * * Console.WriteLine("List2" + list2); * * Console.WriteLine("List1 before circle: " + list1); * SortedPosList s3 = list1.CircleContent(new Position(7, 5), 5); * Console.WriteLine("List1 after circle: " + s3); */ Position p1 = new Position(2, 4); Position p2 = new Position(4, 2); Console.WriteLine($"P1: {p1}"); Console.WriteLine($"P2: {p2}"); Console.WriteLine(p1.Length()); Console.WriteLine(p1.Equals(p2)); Position p3 = p2.Clone(); Console.WriteLine($"P3: {p3}"); Console.WriteLine(p1); Console.WriteLine(p1 > p2); Console.WriteLine(p1 < p2); Console.WriteLine(p1 + p2); Console.WriteLine(p1 - p2); Console.WriteLine(p1 % p2); SortedPosList sp1 = new SortedPosList(); SortedPosList sp2 = new SortedPosList(); sp1.Add(new Position(2, 4)); sp1.Add(new Position(3, 5)); sp1.Add(new Position(1, 5)); sp1.Add(new Position(1, 1)); sp2.Add(new Position(2, 2)); sp2.Add(new Position(5, 5)); sp1.Add(p1); Console.WriteLine(sp1.ToString()); Console.WriteLine(sp1.Count()); sp1.Remove(p1); Console.WriteLine(sp1); SortedPosList sp3 = sp1.Clone(); Console.WriteLine(sp3); SortedPosList sp4 = sp1.CircleContent(new Position(5, 5), 4); Console.WriteLine(sp4); Console.WriteLine(sp1 + sp2); Console.WriteLine(sp1[1]); Console.WriteLine(sp1 * sp2); }
public static void Main(string[] args) { //Skapar upp lite possitioner för att lägga in i listor Position one = new Position(3, 3); Position two = one.Clone(); Position three = new Position(4, 4); Position four = one + three; Position five = three - one; Position six = new Position(10, 10); //Tester av operatorer double distanceBetween = one % three; bool larger = three > one; bool larger2 = one > three; bool smaller = three < one; bool smaller2 = one < three; //Lägger in possitioner i en SortedPosList SortedPosList sorted = new SortedPosList(); sorted.Add(three); sorted.Add(one); sorted.Add(four); sorted.Add(five); //Utskrifter av resultat på operatorer samt metoder Console.WriteLine("Förväntar mig avståndet från origo till given position {0}", one); Console.WriteLine("Testing Length() : {0} \n", one.Length()); Console.WriteLine("Förväntar mig false, (3, 3) är inte lika med (4, 4)"); Console.WriteLine("Testing Equals() : {0} \n", one.Equals(three)); Console.WriteLine("Förvänar mig (3, 3) då jag klonat position one som är (3, 3)"); Console.WriteLine("Testing Clone() samt ToString() : {0} \n", two); Console.WriteLine("Förväntar mig true, (4, 4) är större än (3, 3)"); Console.WriteLine("Testing operator > : {0} \n", larger); Console.WriteLine("Förväntar mig false, (3, 3) är INTE större än (4, 4)"); Console.WriteLine("Testing operator > : {0} \n", larger2); Console.WriteLine("förväntar mig false, (4, 4) är inte mindre än (3, 3)"); Console.WriteLine("Testing operator < : {0} \n", smaller); Console.WriteLine("förväntar mig true, (3, 3) är mindre än (4, 4)"); Console.WriteLine("Testing operator < : {0} \n", smaller2); Console.WriteLine("förväntar mig (7, 7) då (3, 3) + (4, 4) blir det"); Console.WriteLine("Testing operator + : {0} \n", four); Console.WriteLine("förväntar mig (1, 1) då (4, 4) - (3, 3) blir det"); Console.WriteLine("Testing operator - : {0} \n", five); Console.WriteLine("förväntar mig avståndet mellan (3, 3) och (4, 4)"); Console.WriteLine("Testing operator % : {0} \n", distanceBetween); Console.WriteLine("förväntar mig 4 då jag lagt till 4 positioner"); Console.WriteLine("Testing Count() on sortedPosList : {0} \n", sorted.SortedList.Count); //Loopar igenom en lista av positioner, ska skrivas ut sorterad Console.WriteLine("Förväntar mig en sorterad lista på fyra positioner"); for (int i = 0; i < sorted.SortedList.Count; i++) { Console.WriteLine("Testing sorting on SortedPosList, Pos {0} contains {1}", i, sorted.SortedList[i]); } Console.WriteLine(); // Testar Remove metoden på en lista, skriver även ut listan efter för att säkertställa att den tagit bort possitionerna Console.WriteLine("Förväntar mig true, true, false samt att listan är två mindre då jag kör Remove() på två positioner"); Console.WriteLine("Testing Remove() on sortedPosList : {0}", sorted.Remove(four)); Console.WriteLine("Testing Remove() on sortedPosList : " + sorted.Remove(two)); Console.WriteLine("Testing Remove() on sortedPosList : {0}", sorted.Remove(six)); foreach (var pos in sorted.SortedList) { Console.WriteLine("After Remove() on SortedPosList, it contains {0}", pos); } Console.WriteLine(); //Testar att klona en lista och skriver ut den sedan SortedPosList sortedCopy = sorted.Clone(); Console.WriteLine("Testing Clone() on a list"); foreach (Position position in sortedCopy.SortedList) { Console.WriteLine("Position in clone : " + position); } Console.WriteLine(); //Test för att kolla om det finns nån cirkel innanför given cirkels pos och radie Console.WriteLine("Förväntar mig två punkter innanför given cirkel med given radie : (1, 1) radie 5"); SortedPosList withinRadius = sorted.CircleContent(new Position(1, 1), 5); foreach (Position position in withinRadius.SortedList) { Console.WriteLine("Positions inside circle : " + position); } Console.WriteLine(); //Skapar upp en ny lista för att kunna testa + operator på listor SortedPosList toAdd = new SortedPosList(); toAdd.Add(new Position(1, 1)); toAdd.Add(new Position(8, 8)); toAdd.Add(new Position(11, 11)); toAdd.Add(new Position(3, 3)); //Test av + operator på listor SortedPosList addingLists = sorted + toAdd; Console.WriteLine("Förväntar mig en ny sammanslagen lista av sorted + toAdd"); Console.WriteLine("Testing operator + on SortedPosLists : {0}", addingLists); Console.WriteLine(); //Tetsar getter på en lista Console.WriteLine("Förväntar mig (4, 4) sorted[1] är det"); Console.WriteLine("Testing getter on position: " + sorted[1]); Console.WriteLine(); //Testar - operator på listor, lägger först till en ny possition i en av listorna för dom är identiska sortedCopy.Add(new Position(20, 20)); Console.WriteLine("Sorted contains: " + sorted); Console.WriteLine("SortedCopy contains: " + sortedCopy); Console.WriteLine("Förväntar mig en position (20, 20)"); Console.WriteLine("Testing operator - on lists: " + (sortedCopy - sorted)); //Test av att skriva till fil, skapar först upp en konstant som är filnamnet den ska skapa om den inte redan finns //sen skapar jag upp två nya SortedPosLists för att kolla allt funkar const string fileName = "writePosToFile.txt"; Console.WriteLine(); Console.WriteLine("Färväntar mig att den skapar upp en fil, sen hintar om att fil redan är \n skapad, samt att den sparar ett antal position till fil"); SortedPosList listFromFile = new SortedPosList(fileName); SortedPosList testLoad2 = new SortedPosList(fileName); //Lägger tilllite possitioner för att se så dom skrivs ner till filen listFromFile.Add(new Position(10, 10)); listFromFile.Add(new Position(1, 1)); listFromFile.Add(new Position(2, 2)); listFromFile.Add(new Position(30, 30)); listFromFile.Add(new Position(5, 5)); listFromFile.Add(new Position(4, 4)); listFromFile.Add(new Position(9, 9)); listFromFile.Add(new Position(5, 5)); //Testar inläsning från fil, skapar upp en ny SortedPosList som ska läsa in alla possitioner som finns i //filen, och skriver sedan ut den Console.WriteLine(); Console.WriteLine("Förväntar mig 'file already created' och att den nya sortedPosList laddar in alla positioner ifrån filen"); SortedPosList testLoad3 = new SortedPosList(fileName); Console.WriteLine("testload 3 : {0}", testLoad3); Console.WriteLine(); //Test för att kolla så att SortedPosList verkligen är synkade till filen Console.WriteLine("Förväntar mig 'file already created fyra gånger då jag skapar fyra nya synkade listor, \n" + "lägger till en ny position (1000, 1000) i en av listorna och loopar igenom för att testa om \n" + "dom verkligen är synkade mot filen"); SortedPosList synced1 = new SortedPosList(fileName); SortedPosList synced2 = new SortedPosList(fileName); SortedPosList synced3 = new SortedPosList(fileName); SortedPosList synced4 = new SortedPosList(fileName); synced4.Add(new Position(1000, 1000)); foreach (SortedPosList sync in SortedPosList.syncedInstances) { Console.WriteLine(sync); } }