Beispiel #1
0
        private Predicate <object> MakeResponseFilterForRule(Rule r)
        {
            // make a closure scanning the response dict for just this rule's responses.
            ResponseSystemWPF ResponseRuleSystem = RRSys;

            // CLI seems to be having trouble with typedefs, so for now introspect the
            // necesasry properties
            System.Reflection.PropertyInfo valprop = RRSys.ResponseGroupsDict[0].GetType().GetProperty("Val");

            return(x =>
            {
                // clumsy hack to filter out NullResponse
                ResponseGroup g = valprop.GetValue(x, null) as ResponseGroup;
                if (g.Count < 1)
                {
                    return false;
                }

                int idx = ResponseRuleSystem.ResponseGroupBinding.IndexOf(x);
                for (int i = 0; i < r.NumCriteria; i++)
                {
                    if (r.get_ResponseIndices(i) == idx)
                    {
                        return true;
                    }
                }
                return false;
            });
        }
Beispiel #2
0
        private Predicate <object> MakeCriterionFilterForRule(Rule r)
        {
            // make a closure scanning the response dict for just this rule's criteria.
            ResponseSystemWPF ResponseRuleSystem = RRSys;

            return(x =>
            {
                int idx = ResponseRuleSystem.CriteriaBinding.IndexOf(x);;
                for (int i = 0; i < r.NumCriteria; i++)
                {
                    if (r.get_CriteriaIndices(i) == idx)
                    {
                        return true;
                    }
                }
                return false;
            });
        }