Esempio n. 1
0
        public override void PropagateRetract(IExecutionContext context, Tuple tuple)
        {
            IEnumerable <Fact> facts = RightSource.GetFacts(context);

            foreach (Fact fact in facts)
            {
                MemoryNode.PropagateRetract(context, tuple, fact);
            }
        }
Esempio n. 2
0
        public override void PropagateAssert(IExecutionContext context, Tuple tuple)
        {
            IEnumerable <Fact> facts = RightSource.GetFacts(context);

            foreach (Fact fact in facts)
            {
                if (MatchesConditions(tuple, fact))
                {
                    PropagateMatchedAssert(context, tuple, fact);
                }
            }
        }
Esempio n. 3
0
        protected TupleFactSet JoinedSet(IExecutionContext context, Tuple tuple)
        {
            int level = tuple.Level;
            var facts = RightSource.GetFacts(context).ToList();

            if (facts.Count > 0)
            {
                IDictionary <long, List <Fact> > factGroups = GroupFacts(facts, level);
                if (factGroups.Count > 0)
                {
                    return(JoinByGroupId(tuple, factGroups));
                }
            }
            return(new TupleFactSet(tuple, facts));
        }
Esempio n. 4
0
        protected IEnumerable <TupleFactSet> JoinedSets(IExecutionContext context, IList <Tuple> tuples)
        {
            if (tuples.Count == 0)
            {
                return(EmptySetList);
            }
            int level = tuples[0].Level;

            var facts = RightSource.GetFacts(context).ToList();

            if (facts.Count > 0)
            {
                IDictionary <long, List <Fact> > factGroups = GroupFacts(facts, level);
                if (factGroups.Count > 0)
                {
                    return(JoinByGroupId(tuples, factGroups));
                }
            }

            return(CrossJoin(tuples, facts));
        }
Esempio n. 5
0
 protected IEnumerable <Fact> MatchingFacts(IExecutionContext context, Tuple tuple)
 {
     return(RightSource.GetFacts(context).Where(fact => MatchesConditions(context, tuple, fact)));
 }