Exemplo n.º 1
0
        public CuLeRule CreateCuLeRule(CuLeRuleDef i_CuLeRuleDef, CuLeQuantifierList i_CuLeQuantifierList, string i_State)
        {
            if (i_CuLeRuleDef is SetOperatorCuLeRuleDef)
            {
                SetOperatorCuLeRuleDef l_SetOperatorCuLeRuleDef = (SetOperatorCuLeRuleDef)i_CuLeRuleDef;

                CuLeSetFactory l_CuLeSetFactory = new CuLeSetFactory(m_Tables, m_Relations, this.m_States);

                CuLeSet SetA = l_CuLeSetFactory.CreateCuLeSet(l_SetOperatorCuLeRuleDef.SetDefA(), i_CuLeQuantifierList, i_State);
                CuLeSet SetB = l_CuLeSetFactory.CreateCuLeSet(l_SetOperatorCuLeRuleDef.SetDefB(), i_CuLeQuantifierList, i_State);

                if (l_CuLeSetFactory.m_errorMessages != null)
                {
                    if (l_CuLeSetFactory.m_errorMessages.Count != 0)
                    {
                        this.m_errorMessages = l_CuLeSetFactory.m_errorMessages;
                    }
                }

                if (SetA != null && SetB != null)
                {
                    return(CreateSetOperatorCuLeRule(SetA, SetB, l_SetOperatorCuLeRuleDef.SetOperator, l_SetOperatorCuLeRuleDef.SourceLocation, i_State));
                }

                if (this.m_errorMessages != null)
                {
                    return(null);
                }

                return(null);
            }

            if (i_CuLeRuleDef is NegationCuLeRuleDef)
            {
                NegationCuLeRuleDef l_NegationCuLeRuleDef = (NegationCuLeRuleDef)i_CuLeRuleDef;

                CuLeRule l_CuLeRule_A = this.CreateCuLeRule(l_NegationCuLeRuleDef.CuLeRuleDef_A(), i_CuLeQuantifierList, i_State);

                return(new NegationCuLeRule(l_CuLeRule_A));

                // CuLeRule l_CuLeRule = this.CreateCuLeRule(l_NegationCuLeRuleDef.CuLeRuleDef_A, i_Tables, i_Relations, i_CuLeQuantifierList)
            }

            if (i_CuLeRuleDef is RuleOperatorCuLeRuleDef)
            {
                RuleOperatorCuLeRuleDef l_RuleOperatorCuLeRuleDef = (RuleOperatorCuLeRuleDef)i_CuLeRuleDef;

                CuLeRule l_CuLeRule_A = this.CreateCuLeRule(l_RuleOperatorCuLeRuleDef.CuLeRuleDef_A(), i_CuLeQuantifierList, i_State);
                CuLeRule l_CuLeRule_B = this.CreateCuLeRule(l_RuleOperatorCuLeRuleDef.CuLeRuleDef_B(), i_CuLeQuantifierList, i_State);

                return(new RuleOperatorCuLeRule(l_CuLeRule_A, l_CuLeRule_B, l_RuleOperatorCuLeRuleDef.RuleOperator));
            }

            if (i_CuLeRuleDef is ConditionalCuLeRuleDef)
            {
                if (i_CuLeRuleDef is ImplicationCuLeRuleDef)
                {
                    if (i_CuLeRuleDef is IF_ImplicationCuLeRuleDef)
                    {
                        IF_ImplicationCuLeRuleDef l_IF_ImplicationCuLeRuleDef = (IF_ImplicationCuLeRuleDef)i_CuLeRuleDef;

                        CuLeRule l_CuLeRule_IF   = this.CreateCuLeRule(l_IF_ImplicationCuLeRuleDef.CuLeRuleDef_IF(), i_CuLeQuantifierList, i_State);
                        CuLeRule l_CuLeRule_THEN = this.CreateCuLeRule(l_IF_ImplicationCuLeRuleDef.CuLeRuleDef_THEN(), i_CuLeQuantifierList, i_State);

                        return(new IF_ImplicationCuLeRule(l_CuLeRule_IF, l_CuLeRule_THEN));
                    }
                    if (i_CuLeRuleDef is IF_ELSE_ImplicationCuLeRuleDef)
                    {
                        IF_ELSE_ImplicationCuLeRuleDef l_IF_ELSE_ImplicationCuLeRuleDef = (IF_ELSE_ImplicationCuLeRuleDef)i_CuLeRuleDef;

                        CuLeRule l_CuLeRule_IF   = this.CreateCuLeRule(l_IF_ELSE_ImplicationCuLeRuleDef.CuLeRuleDef_IF(), i_CuLeQuantifierList, i_State);
                        CuLeRule l_CuLeRule_THEN = this.CreateCuLeRule(l_IF_ELSE_ImplicationCuLeRuleDef.CuLeRuleDef_THEN(), i_CuLeQuantifierList, i_State);
                        CuLeRule l_CuLeRule_ELSE = this.CreateCuLeRule(l_IF_ELSE_ImplicationCuLeRuleDef.CuLeRuleDef_ELSE(), i_CuLeQuantifierList, i_State);

                        return(new IF_ELSE_ImplicationCuLeRule(l_CuLeRule_IF, l_CuLeRule_THEN, l_CuLeRule_ELSE));
                    }
                }
                if (i_CuLeRuleDef is EquivalenceCuLeRuleDef)
                {
                    EquivalenceCuLeRuleDef l_EquivalenceCuLeRuleDef = (EquivalenceCuLeRuleDef)i_CuLeRuleDef;

                    CuLeRule l_CuLeRule_A = this.CreateCuLeRule(l_EquivalenceCuLeRuleDef.CuLeRuleDef_A(), i_CuLeQuantifierList, i_State);
                    CuLeRule l_CuLeRule_B = this.CreateCuLeRule(l_EquivalenceCuLeRuleDef.CuLeRuleDef_B(), i_CuLeQuantifierList, i_State);

                    return(new EquivalenceCuLeRule(l_CuLeRule_A, l_CuLeRule_B));
                }
            }

            throw new ArgumentException("Rule Definition Error");
        }// End of Create CuLeRule
Exemplo n.º 2
0
 public EquivalenceCuLeRule(CuLeRule i_CuLeRule_A, CuLeRule i_CuLeRule_B)
 {
     m_CuLeRule_A = i_CuLeRule_A;
     m_CuLeRule_B = i_CuLeRule_B;
 }
Exemplo n.º 3
0
 public IF_ELSE_ImplicationCuLeRule(CuLeRule i_CuLeRule_IF, CuLeRule i_CuLeRule_THEN, CuLeRule i_CuLeRule_ELSE)
 {
     m_CuLeRule_IF   = i_CuLeRule_IF;
     m_CuLeRule_THEN = i_CuLeRule_THEN;
     m_CuLeRule_ELSE = i_CuLeRule_ELSE;
 }
Exemplo n.º 4
0
 public IF_ImplicationCuLeRule(CuLeRule i_CuLeRule_IF, CuLeRule i_CuLeRule_THEN)
 {
     m_CuLeRule_IF   = i_CuLeRule_IF;
     m_CuLeRule_THEN = i_CuLeRule_THEN;
 }
Exemplo n.º 5
0
 public RuleOperatorCuLeRule(CuLeRule i_CuLeRule_A, CuLeRule i_CuLeRule_B, RuleOperator i_RuleOperator)
 {
     m_CuLeRule_A   = i_CuLeRule_A;
     m_CuLeRule_B   = i_CuLeRule_B;
     m_RuleOperator = i_RuleOperator;
 }
Exemplo n.º 6
0
 public NegationCuLeRule(CuLeRule i_CuLeRule)
 {
     m_CuLeRule = i_CuLeRule;
 }