Exemple #1
0
        private FactMatch[] GetMatchedFacts()
        {
            var matches    = CompiledRule.Declarations.Select(x => new FactMatch(x)).ToArray();
            int index      = Tuple.Count - 1;
            var enumerator = Tuple.GetEnumerator();

            while (enumerator.MoveNext())
            {
                int factIndex = CompiledRule.FactMap[index];
                var factMatch = matches[factIndex];
                factMatch.SetFact(enumerator.Current);
                index--;
            }
            return(matches);
        }
Exemple #2
0
        public bool IsSatisfiedBy(Tuple leftTuple, Fact rightFact)
        {
            var rightTuple = ((WrapperFact)rightFact).WrappedTuple;

            using (IEnumerator <Fact> enumerator1 = leftTuple.GetEnumerator())
                using (IEnumerator <Fact> enumerator2 = rightTuple.GetEnumerator())
                {
                    while (enumerator1.MoveNext() && enumerator2.MoveNext())
                    {
                        if (enumerator1.Current != enumerator2.Current)
                        {
                            return(false);
                        }
                    }
                }
            return(true);
        }