Exemple #1
0
 protected Process(Process parent, Proposal proposal)
 {
     Parent   = parent;
     Depth    = parent.Depth + 1;
     Proposal = proposal;
     Process  = parent.Process;
     Brain    = parent.Brain;
     Expert   = parent.Expert;
     Init();
 }
Exemple #2
0
        //
        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);
        }
Exemple #3
0
 //
 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);
     }
 }
Exemple #4
0
 public static void Save(this Proposal proposal, XmlWriter writer)
 {
     writer.WriteStartElement("proposal");
     proposal.Message.Save(writer);
     writer.WriteEndElement();
 }
Exemple #5
0
 /*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;
 }