コード例 #1
0
        bool ActiveRule(IDirectionRule rule, DataSample data)
        {
            if (rule.IsActive(data))
            {
                currentRule = rule;
                rule.Direct(data);
                return(true);
            }

            return(false);
        }
コード例 #2
0
        public void Process(DataSample data)
        {
            if (ActiveRule(currentRule, data))
                return;

            foreach (var rule in directionRules)
                if (ActiveRule(rule, data))
                    return;

            currentRule = ruleRandom;
            currentRule.Direct(data);
        }
コード例 #3
0
        public void Direct(DataSample data)
        {
            if (isVetoed)
            {
                vetoRule.Direct(data);
                return;
            }

            if (wasVetored)
            {
                mainRule.Redirect(data);
            }

            wasVetored = false;

            mainRule.Direct(data);
        }
コード例 #4
0
        public void Process(DataSample data)
        {
            if (ActiveRule(currentRule, data))
            {
                return;
            }

            foreach (var rule in directionRules)
            {
                if (ActiveRule(rule, data))
                {
                    return;
                }
            }

            currentRule = ruleRandom;
            currentRule.Direct(data);
        }
コード例 #5
0
        bool ActiveRule(IDirectionRule rule, DataSample data)
        {
            if (rule.IsActive(data))
            {
                currentRule = rule;
                rule.Direct(data);
                return true;
            }

            return false;
        }