private void InsertAllGroupsAndPointPairLists(string[] uniqueGroupNames, int docNodeCount) { var uniqueGroups = uniqueGroupNames.Select(n => new ReplicateGroup(n, ReplicateIndexSet.OfValues(ReplicateGroups.Where(r => r.GroupName == n).SelectMany(r => r.ReplicateIndexes)), null, true)); var newGroups = ReplicateGroups.ToList(); foreach (var group in uniqueGroups) { var group1 = group; var firstIndex = newGroups.IndexOf(r => r.GroupName == group1.GroupName); newGroups.Insert(firstIndex, group); for (var node = 0; node < docNodeCount; ++node) { for (var step = 0; step < PointPairLists[node].Count; ++step) { if (PointPairLists[node][step].Any()) { PointPairLists[node][step].Insert(firstIndex, new PointPair(firstIndex, double.NaN)); } } } } ReplicateGroups = newGroups; }
private void RemoveEmptyGroups(int docNodeCount) { var groups = ReplicateGroups.ToList(); for (var i = 0; i < groups.Count; ++i) { var index = i; var removeGroup = ShouldRemoveGroup(index); if (removeGroup && groups[index].IsAllGroup) { var fileGroups = groups.Select((g, j) => j).Where(j => groups[j].GroupName == groups[index].GroupName && !groups[j].IsAllGroup); removeGroup = fileGroups.Any(j => !ShouldRemoveGroup(j)); } if (removeGroup) { for (var node = 0; node < docNodeCount; ++node) { for (var step = 0; step < PointPairLists[node].Count; ++step) { if (PointPairLists[node][step].Any()) { PointPairLists[node][step].RemoveAt(i); // Fix x values for (var j = i; j < PointPairLists[node][step].Count; ++j) { --PointPairLists[node][step][j].X; } } } } groups.RemoveAt(i); --i; } } ReplicateGroups = groups; }