Esempio n. 1
0
        public static void MakeReady(RuleBase ruleBase)
        {
            ruleBase.m_Rules.Clear();

            string line;

            char[]   separator = { ' ', '\t', '\n' };
            string[] tokens;
            string[] s = Rules.GetRules();
            for (int i = 0; i < s.Length; i++)
            {
                line = s[i].Trim();
                if (line.Length > 0 && line[0] != ';')
                {
                    Rule rule = new Rule();

                    tokens = line.Split(separator);
                    int idx = 0;
                    while (!tokens[idx].Equals("then"))
                    {
                        RuleCondition ruleCondition = new RuleCondition(tokens[idx + 1], tokens[idx + 3]);
                        rule.AddCondition(ruleCondition);
                        idx += 4;
                    }
                    RuleConclusion ruleConclusion = new RuleConclusion(tokens[idx + 2]);
                    rule.SetConclusion(ruleConclusion);

                    ruleBase.AddRule(rule);
                }
            }
        }
Esempio n. 2
0
        public static void MakeReady( RuleBase ruleBase )
        {
            ruleBase.m_Rules.Clear();

            string line;
            char[] separator = {' ', '\t', '\n'};
            string[] tokens;
            string[] s = Rules.GetRules();
            for ( int i = 0; i < s.Length; i++ )
            {
                line = s[i].Trim();
                if ( line.Length > 0 && line[0] != ';' )
                {
                    Rule rule = new Rule();

                    tokens = line.Split( separator );
                    int idx = 0;
                    while ( !tokens[idx].Equals( "then" ) )
                    {
                        RuleCondition ruleCondition = new RuleCondition( tokens[idx+1], tokens[idx+3] );
                        rule.AddCondition( ruleCondition );
                        idx += 4;
                    }
                    RuleConclusion ruleConclusion = new RuleConclusion( tokens[idx+2] );
                    rule.SetConclusion( ruleConclusion );

                    ruleBase.AddRule( rule );
                }
            }
        }
Esempio n. 3
0
 public InferenceEngine()
 {
     m_RuleBase = new RuleBase();
 }
Esempio n. 4
0
 public InferenceEngine()
 {
     m_RuleBase = new RuleBase();
 }
Esempio n. 5
0
 public static void MakeReady(InferenceEngine infEng)
 {
     RuleBase.MakeReady(infEng.m_RuleBase);
 }