Пример #1
0
        public override void PropagateRetract(IExecutionContext context, Fact fact)
        {
            IEnumerable <Tuple> tuples = LeftSource.GetTuples(context);

            foreach (Tuple tuple in tuples)
            {
                MemoryNode.PropagateRetract(context, tuple, fact);
            }
        }
Пример #2
0
        public override void PropagateAssert(IExecutionContext context, Fact fact)
        {
            IEnumerable <Tuple> tuples = LeftSource.GetTuples(context);

            foreach (Tuple tuple in tuples)
            {
                if (MatchesConditions(context, tuple, fact))
                {
                    MemoryNode.PropagateAssert(context, tuple, fact);
                }
            }
        }
Пример #3
0
        public override void PropagateUpdate(IExecutionContext context, Fact fact)
        {
            IEnumerable <Tuple> tuples = LeftSource.GetTuples(context);

            foreach (Tuple tuple in tuples)
            {
                if (MatchesConditions(tuple, fact))
                {
                    PropagateMatchedUpdate(context, tuple, fact);
                }
                else
                {
                    PropagateMatchedRetract(context, tuple, fact);
                }
            }
        }
Пример #4
0
        protected IEnumerable <TupleFactSet> JoinedSets(IExecutionContext context, IList <Fact> facts)
        {
            var tuples = LeftSource.GetTuples(context).ToList();

            if (tuples.Count == 0)
            {
                return(EmptySetList);
            }
            int level = tuples[0].Level;

            IDictionary <long, List <Fact> > factGroups = GroupFacts(facts, level);

            if (factGroups.Count > 0)
            {
                return(JoinByGroupId(tuples, factGroups));
            }

            return(CrossJoin(tuples, facts));
        }
Пример #5
0
 protected IEnumerable <Tuple> MatchingTuples(IExecutionContext context, Fact fact)
 {
     return(LeftSource.GetTuples(context).Where(tuple => MatchesConditions(context, tuple, fact)));
 }