public Initial Generate() { Join previousJoin = null; var initial = new Initial { Name = "ServiceMatrix Guidance", }; foreach (var topic in this.Items.GroupBy(x => x.Item1)) { var fork = new Fork { Name = topic.Key.Trim(), }; if (previousJoin == null) initial.ConnectTo(fork); else previousJoin.ConnectTo(fork); var lastItem = this.GenerateItems(topic, fork); var join = new Join { Name = topic.Key + "Join", }; lastItem.ConnectTo(join); previousJoin = join; } var final = new Final { Name = "Final", }; previousJoin.ConnectTo(final); return initial; }
/// <summary> /// Connects this activity with the <see cref="Join"/> received as parameter. /// </summary> /// <param name="node">The <see cref="Join"/> to connect as successor of this activity.</param> public virtual void ConnectTo(Join node) { Guard.NotNull(() => node, node); this.ConnectTo(new Node[] { node }); }