Exemple #1
0
        private List <Group> LocateGroups(PatientMatrix <T> matrix)
        {
            var groups  = new List <Group>();
            var visited = new PatientMatrix <bool>(matrix.Rows, matrix.Columns);

            // loop through all coordinates in matrix that are not yet visited
            foreach (var coordinate in matrix.Where(c => !visited[c]))
            {
                // assign visited flag for this coordinates to true
                visited[coordinate] = true;

                // Determines whether the specified object equals to the current object
                if (!matrix[coordinate].Equals(_groupValue))
                {
                    continue;
                }

                // Construct the group and add it to the generic list.
                var group = new GroupConstructor <T>(matrix, visited).Construct(coordinate);
                groups.Add(group);
            }
            // return group list
            return(groups);
        }
Exemple #2
0
 // Class constructor
 public GroupConstructor(PatientMatrix <T> matrix, PatientMatrix <bool> visited)
 {
     _visited = visited;
     _matrix  = matrix;
 }