• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IContinuation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IContinuation的典型用法代码示例。如果您正苦于以下问题:C# IContinuation类的具体用法?C# IContinuation怎么用?C# IContinuation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IContinuation类属于命名空间,在下文中一共展示了IContinuation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Instantiate

        public static ContinueToCallAgent Instantiate(CallAgent agent, Context context, IContinuation succ, IFailure fail)
        {
            ContinueToCallAgent continuer = new ContinueToCallAgent(agent, succ);
            continuer.SetResult(new TwoTuple<Context, IFailure>(context, fail), context.Weight, "ContinueToCallAgent: Instantiate");

            return continuer;
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:7,代码来源:ContinueToCallAgent.cs


示例2: Match

        public PatternMatch Match(AmbiguousPhrase phrase, IContinuation succ, IFailure fail)
        {
            //IArena arena = new QueueArena();
            //arena.Call();

            return null;
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:7,代码来源:TempleMatcher.cs


示例3: Evaluator

 public Evaluator(double salience, ArgumentMode argumentMode, IContinuation valuesucc, IContinuation aftersucc, bool isUserInput)
     : base(salience, 2 * 4, 100, valuesucc)
 {
     this.argumentMode = argumentMode;
     this.aftersucc = aftersucc;
     this.isUserInput = isUserInput;
 }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:7,代码来源:Evaluator.cs


示例4: Call

        public int Call(object value, IContinuation succ, IFailure fail)
        {
            if (aborter.IsAborted)
                return 1;   // abort!

            List<IAction> namedacts = plugenv.GetNamedActions(resultType.Name);
            // Remove all actions that have already been used
            int ii = 0;
            while (ii < namedacts.Count)
            {
                if (searched.ContainsKey(namedacts[ii]))
                    namedacts.RemoveAt(ii);
                else
                {
                    searched.Add(namedacts[ii], 1);
                    ii++;
                }
            }

            if (namedacts.Count == 0)
                return arena.Fail(fail, salience, "no matching acts", succ);

            IContinuation next = new ContinueletWrapper(CheckAction, value, succ);
            IFailure more = new FailletWrapper(RecurseConversionAttempt, value, namedacts, succ);

            if (namedacts.Count == 1)
                return arena.Continue(next, salience, namedacts[0], more) + 2;

            TryValues<IAction> tryeach = new TryValues<IAction>();
            return arena.Call(tryeach, salience * .9, namedacts, next, more) + 3;
        }
开发者ID:sarang25491,项目名称:Virsona-ChatBot-Tools,代码行数:31,代码来源:ActionConversion.cs


示例5: Call

        public override bool Call(object value, IContinuation succ, IFailure fail)
        {
            if (breakpointCall)
                Console.WriteLine("Breakpoint in MatchProduceAgent");
            Context context = (Context) value;
            bool production = context.LookupDefaulted<bool>("$production", false);
            if (!production)
            {
                object check = context.LookupDefaulted<object>("$check", null);

                if (check == null)
                {
                    // Matcher did not call us
                    List<IContent> contents = new List<IContent>();
                    Context child = new Context(context, contents);
                    // Put us into content stream, for matcher to find
                    contents.Add(new Value(this));
                    // Save this context-- we'll use it later!
                    child.Map["$argctx"] = context;

                    succ.Continue(child, fail);
                    return true;
                }

                Context argctx = context.LookupDefaulted<Context>("$argctx", context);
                // Add our context, shadowing variables in argctx
                Context argctxchild = argctx.ChildRange(0);
                argctxchild.AddMappings(context);

                return Match(check, argctxchild, succ, fail);
            }
            else
                return Produce(context, succ, fail);
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:34,代码来源:MatchProduceAgent.cs


示例6: ContinueCodelet

 public ContinueCodelet(double salience, Context context, IContinuation succ, IFailure fail)
     : base(context.Coderack, salience, 4 * 4, 5)
 {
     this.context = context;
     this.succ = succ;
     this.fail = fail;
 }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:7,代码来源:ContinueCodelet.cs


示例7: CallableAsEvaluable

 public CallableAsEvaluable(ICallable callable, object value, IContinuation succ, IFailure fail)
 {
     this.callable = callable;
     this.value = value;
     this.succ = succ;
     this.fail = fail;
 }
开发者ID:jrising,项目名称:ActionReaction,代码行数:7,代码来源:Callables.cs


示例8: Call

        public override bool Call(object value, IContinuation succ, IFailure fail)
        {
            Context context = (Context) value;
            if (principleSource == null || assertionSource == null) {
                fail.Fail("ConceptNet sources missing", succ);
                return true;
            }

            Notion concept;
            if (!principleSource.TryGetValue(StarUtilities.ContentsCode(context, tagger, parser), out concept))
            {
                fail.Fail("Could not find produced in ConceptNet", succ);
                return true;
            }

            List<Assertion> assertions;
            if (!assertionSource.TryGetValue(new KeyValuePair<Notion, string>(concept, relation), out assertions))
                assertions = new List<Assertion>();

            List<IContent> contents = new List<IContent>();

            foreach (Assertion assertion in assertions)
            {
                contents.Add(new Word(assertion.Sentence));
                contents.Add(new Word(" ."));
            }

            succ.Continue(new Context(context, contents), fail);
            return true;
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:30,代码来源:AbstractVariables.cs


示例9: PromiseAsyncExecutionEventArgs

 /// <summary>
 /// Initializes a new instance of the PromiseAsyncExecutionEventArgs
 /// class.
 /// </summary>
 /// <param name="continuation">
 /// The continuation to be invoked when the async operation completes.
 /// </param>
 public PromiseAsyncExecutionEventArgs(IContinuation continuation)
 {
     if (continuation == null)
     {
         throw new ArgumentNullException("continuation");
     }
     this.continuation = continuation;
 }
开发者ID:KevinOrtman,项目名称:azure-mobile-services,代码行数:15,代码来源:PromiseAsyncExecutionEventArgs.cs


示例10: Call

 public int Call(ICallable callable, double salience, object value, IContinuation succ, IFailure fail)
 {
     if (callable is IAgent)
         ((IAgent)callable).Initialize(this, salience);
     if (salience > 0)
         return callable.Call(value, succ, fail);
     return 1;
 }
开发者ID:sarang25491,项目名称:Virsona-ChatBot-Tools,代码行数:8,代码来源:ImmediateArena.cs


示例11: Matcher

 // Don't call this.  Call MatchAgainst
 protected Matcher(double salience, IParsedPhrase input, List<IParsedPhrase> unmatched, IContinuation succ)
     : base(salience, 2 * 4, 10, succ)
 {
     if (input == null)
         throw new NullReferenceException("Input cannot be null.");
     this.input = input;
     this.unmatched = new List<IParsedPhrase>(unmatched);   // make copy, or %opt-fail has effects
 }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:9,代码来源:Matcher.cs


示例12: Match

        public override bool Match(object check, Context context, IContinuation succ, IFailure fail)
        {
            List<Relations.Relation> kinds = new List<Relations.Relation>();
            kinds.Add(Relations.Relation.AtTime);

            Thinker.SearchForMatch(salience, memory, kinds, (Datum) check, context, succ, fail);

            return true;
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:9,代码来源:KnowledgeVariables.cs


示例13: PrintContents

        public static bool PrintContents(Context context, IContinuation succ, IFailure fail, params object[] args)
        {
            PluginEnvironment plugenv = (PluginEnvironment) args[0];
            POSTagger tagger = new POSTagger(plugenv);
            GrammarParser parser = new GrammarParser(plugenv);

            Console.WriteLine(StarUtilities.ProducedCode(context, tagger, parser));
            succ.Continue(new Context(context, new List<IContent>()), fail);
            return true;
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:10,代码来源:OutputVariables.cs


示例14: Fail

 public int Fail(IFailure fail, double salience, string reason, IContinuation skip)
 {
     // Clone it!
     fail = (IFailure)fail.Clone();
     if (fail is IAgent)
         ((IAgent)fail).Initialize(this, salience);
     if (salience > 0)
         return fail.Fail(reason, skip);
     return 1;
 }
开发者ID:sarang25491,项目名称:Virsona-ChatBot-Tools,代码行数:10,代码来源:ImmediateArena.cs


示例15: ContinuationAppender

        public ContinuationAppender(Context master, IContinuation succ)
        {
            this.master = master;
            this.succ = succ;
            indexes = 0;

            // filled upon continuation
            callers = new List<uint>();
            completes = new List<Context>();
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:10,代码来源:ContinuationAppender.cs


示例16: FailToTryToRescue

 bool FailToTryToRescue(IArena arena, double salience, string reason, IContinuation skip, params object[] args)
 {
     TryToRescueMatch tryToRescueMatch = (TryToRescueMatch) args[0];
     IParsedPhrase input = (IParsedPhrase) args[1];
     PatternTemplateSource patternTemplateSource = (PatternTemplateSource) args[2];
     IContinuation succ = (IContinuation) args[3];
     IFailure fail = (IFailure) args[4];
     Coderack coderack = (Coderack) args[5];
     return tryToRescueMatch.CallRescue(coderack, input, patternTemplateSource, reason, skip, succ, fail);
 }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:10,代码来源:TryToRescueMatch.cs


示例17: Continue

 public int Continue(IContinuation cont, double salience, object value, IFailure fail)
 {
     // Clone it!
     cont = (IContinuation)cont.Clone();
     if (cont is IAgent)
         ((IAgent)cont).Initialize(this, salience);
     if (salience > 0)
         return cont.Continue(value, fail);
     return 1;
 }
开发者ID:sarang25491,项目名称:Virsona-ChatBot-Tools,代码行数:10,代码来源:ImmediateArena.cs


示例18: Produce

        public override bool Produce(Context context, IContinuation succ, IFailure fail)
        {
            object var = context.LookupDefaulted<object>("$p$" + name, null);

            if (var is IParsedPhrase)
                succ.Continue((IParsedPhrase)var, fail);

            succ.Continue(null, fail);

            return true;
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:11,代码来源:ProgressiveVariableAgent.cs


示例19: PatternTemplateSource

        public PatternTemplateSource(PatternTemplateSource parent, Coderack coderack, double salience, IContinuation succ)
        {
            pattern = parent.pattern;
            template = parent.template;
            score = parent.score;
            source = parent.source;

            this.coderack = coderack;
            this.salience = salience;
            this.succ = succ;
        }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:11,代码来源:PatternTemplateSource.cs


示例20: Thinker

 public Thinker(double salience, Memory memory, List<Relations.Relation> kinds, Datum check, IContinuation succ)
     : base(salience, 4 * 7, timeEach, succ)
 {
     this.memory = memory;
     this.kinds = kinds;
     directchecks = new List<Datum>();
     directchecks.Add(check);
     parentchecks = new Queue<Concept>();
     parentchecks.Enqueue(check.Left);
     parentchecks.Enqueue(check.Right);
 }
开发者ID:killix,项目名称:Virsona-ChatBot-Tools,代码行数:11,代码来源:Thinker.cs



注:本文中的IContinuation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IContinuousDistribution类代码示例发布时间:2022-05-24
下一篇:
C# IContextualResourceModel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap