Esempio n. 1
0
 static ListGroups()
 {
     List<Group> groupsConstructor = new List<Group>();
     CSV = (from line in File.ReadAllLines(CSVPATH).Skip(1)
             let columns = line.Split(',')
             select new CsvRow
             {
                 DoorId = int.Parse(columns[0]),
                 Building = columns[1],
                 GroupId = int.Parse(columns[2]),
                 Latitude = double.Parse(columns[3]),
                 Longitude = double.Parse(columns[4])
             })
             .ToList();
     int i = 0;
     foreach (CsvRow row in CSV)
     {
         if (i == row.GroupId)
         {
             Group g = new Group(row.GroupId);
             groupsConstructor.Add(g);
             i++;
         }
     }
     GROUPS = groupsConstructor;
 }
Esempio n. 2
0
 public static Edge ShortestEdge(Group groupA, Group groupB)
 {
     Edge e = null;
     foreach (Door doorA in groupA.Doors)
     {
         foreach (Door doorB in groupB.Doors)
         {
             Edge tempE = new Edge(doorA, doorB);
             if (e == null)
             {
                 e = tempE;
                 continue;
             }
             if (e.Distance > tempE.Distance)
             {
                 e = tempE;
             }
         }
     }
     return e;
 }
Esempio n. 3
0
 public static List<Edge> FindPath(Group groupA, Group groupB)
 {
     return FindPath(groupA.Id, groupB.Id);
 }
Esempio n. 4
0
 public Edge ShortestEdge(Group g)
 {
     return ShortestEdge(this, g);
 }
Esempio n. 5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="group"></param>
 /// <returns></returns>
 public static List<Edge> GetEdges(Group group)
 {
     return GetEdges(group.Id);
 }