/** * {@inheritdoc} */ public void RemoveEdge(IActivity node) { for (int i = 0; i < edges.Count; i++) { IActivity adjNode = edges[i].Adjacent; if (node.Equals(adjNode)) { edges.RemoveAt(i); } } }
/** * Helper that converts agenda to string. * * @param Wem.Activity.IActivity root * The root activity for the iteration. * @param HashSet<string> printedNodes * Hash set of nodes that were already printed (to avoid infinite calls). * @param string indent * The indentation for this iteration. */ private string ToStringHelper(IActivity root, HashSet <string> printedNodes, string indent = "") { printedNodes.Add(root.Id); string s = ""; if (root.Equals(RootActivity)) { s += indent + root.Id + " at " + root.Areas[0].Id + " -> \n"; } indent += " "; foreach (var edge in root.GetEdges()) { IActivity adj = edge.Adjacent; s += indent + adj.Id + " at " + adj.Areas[0].Id; // Only prints the children of the adjacent node if they were not // previously printed. if (!printedNodes.Contains(adj.Id)) { if (adj.GetEdges().Count > 0) { s += " -> "; } s += "\n"; s += ToStringHelper(adj, printedNodes, indent); } else { s += "\n"; } } return(s); }