Example #1
0
 public virtual Task Insert(TupleContext <TLeft> context)
 {
     return(_rightSource.All(context, async factContext =>
     {
         var match = await Evaluate(context, context.Tuple, factContext.Fact).ConfigureAwait(false);
         if (match)
         {
             await MemoryNode.Insert(context, context.Tuple, factContext.Fact).ConfigureAwait(false);
         }
     }));
 }
Example #2
0
 protected Task Matching(TupleContext <TLeft> context, Func <FactContext <TRight>, Task> callback)
 {
     return(_rightSource.All(context, async factContext =>
     {
         var match = await Evaluate(context, context.Tuple, factContext.Fact).ConfigureAwait(false);
         if (match)
         {
             await callback(new SessionFactContext <TRight>(context, factContext.Fact)).ConfigureAwait(false);
         }
     }));
 }
Example #3
0
        public override object VisitTuple(TupleContext context)
        {
            var obj = "(";

            foreach (var(i, v) in context.tupleItem().WithIndex())
            {
                var r = ((Result)Visit(v));
                if (i == 0)
                {
                    obj += r.text;
                }
                else
                {
                    obj += ", " + r.text;
                }
            }
            obj += ")";
            return(new Result("var", obj));
        }
Example #4
0
        public override object VisitTuple(TupleContext context)
        {
            var obj = "(";

            foreach (var i in range(0, context.expression().Length - 1, 1, true, true))
            {
                var r = (Result)(Visit(context.expression(i)));
                if (i == 0)
                {
                    obj += r.text;
                }
                else
                {
                    obj += ", " + r.text;
                }
            }
            obj += ")";
            return(new Result()
            {
                data = "var", text = obj
            });
        }
Example #5
0
        public override object VisitTuple([NotNull] TupleContext context)
        {
            var obj = "(";

            for (int i = 0; i < context.expression().Length; i++)
            {
                var r = (Result)Visit(context.expression(i));
                if (i == 0)
                {
                    obj += r.text;
                }
                else
                {
                    obj += ", " + r.text;
                }
            }
            obj += ")";
            var result = new Result {
                data = "var", text = obj
            };

            return(result);
        }
Example #6
0
 public Task Activate(TupleContext <T> context, IndexMap indexMap)
 {
     return(TaskUtil.Completed);
 }
Example #7
0
 public Task Insert(TupleContext <T> context)
 {
     return(_ruleNodes.All(node => node.Activate(context, _indexMap)));
 }
 public TuplesSteps(TupleContext tupleContext)
 {
     _tupleContext = tupleContext;
 }
Example #9
0
        public Task Insert(TupleContext <T> context)
        {
            _tuples.Add(context);

            return(TaskUtil.Completed);
        }