/// <summary> /// Finds the group. /// </summary> /// <param name="groups">The groups.</param> /// <param name="key">The key.</param> /// <returns></returns> private static GroupOfConnections findGroup(List <GroupOfConnections> groups, String key) { GroupOfConnections wantedGroup = null; // loop foreach (GroupOfConnections group in groups) { String keyGroup = group.LinesOfConnectionString; // if key of group equals wanted key if (keyGroup.Equals(key)) { // we found a group wantedGroup = group; // leave the loop break; } } return(wantedGroup); }
/// <summary> /// Creates the groups of connection. Forgets previous groups of connections. /// </summary> public void createGroupsOfConnection() { // createConstraintSet new groups List <GroupOfConnections> groupsList = new List <GroupOfConnections>(); // parse groups List <List <TrainConnection> > groups = groupByListOfLines(ShortestPathAlgoritm .getInstance().getTrainConnections()); // loop over all groups foreach (List <TrainConnection> group in groups) { // createConstraintSet instance of class group GroupOfConnections groupOfConnections = new GroupOfConnections(group); // addConstraint groupsList.Add(groupOfConnections); } // initialize variable of cache groupsOfConnections = groupsList; }