protected Process(Process parent, Proposal proposal) { Parent = parent; Depth = parent.Depth + 1; Proposal = proposal; Process = parent.Process; Brain = parent.Brain; Expert = parent.Expert; Init(); }
// protected Process Create(Proposal proposal) { Process process = new Process(this, proposal); process.Context.Clauses.AddRange(Context.Clauses); if (proposal.Context != null) { process.ImportContext(proposal.Context); } //context.Post(proposal.Message); proposal.Callback(process, proposal.Expert, proposal.Message); Processes.Add(process); Brain.ProcessCreated(process); process.Schedule(Process); return(process); }
// public void Propose(Process process, Message message, Context importContext) { foreach (Trigger trigger in MatchTrigger(message)) { Proposal proposal = new Proposal(); proposal.Message = message; proposal.Expert = this; proposal.Callback = trigger.Callback; proposal.Context = importContext; process.Propose(proposal); } if (Parent != null) { Parent.Propose(process, message, importContext); } }
public static void Save(this Proposal proposal, XmlWriter writer) { writer.WriteStartElement("proposal"); proposal.Message.Save(writer); writer.WriteEndElement(); }
/*public void Propose(Message msg, Context context) * { * Proposal proposal = new Proposal(); * proposal.Message = msg; * proposal.Context = context; * Propose(proposal); * }*/ public void Propose(Proposal proposal) { MaybeSchedule(); Proposals.Add(proposal); HasProposed = true; }