public void AddServiceNode(ISequentialIntServiceNode node) { this.nodes.Add(node); }
private void DistributeTheNode(ISequentialIntServiceNode node) { var counter = 0; if (this.nodes.FirstOrDefault(x => x.Id == node.Id) != null) counter++; else { this.AddServiceNode(node); counter++; } foreach (var service in this.services) { var serviceNodes = service.GetServiceNodes(); if (serviceNodes.FirstOrDefault(x => x.Id == node.Id) != null) counter++; } var minimumServicesForNode = services.Count == 1 ? 2 : (services.Count / 2) + 1; while (counter < minimumServicesForNode) { this.services.FirstOrDefault(x => x.GetServiceNodes().FirstOrDefault(y => y.Id == node.Id) == null).AddServiceNode(node); counter++; } }