Example #1
0
 /// <summary> TODO need to finish implementing the clone method
 /// </summary>
 public Object Clone()
 {
     Defrule cl = new Defrule(_name);
     return cl;
 }
Example #2
0
        /// <summary> TODO need to finish implementing the clone method
        /// </summary>
        public Object Clone()
        {
            Defrule cl = new Defrule(_name);

            return(cl);
        }
Example #3
0
        public Defrule ruleBody()
        {
            Token exp = null;
            Token rulecomment = null;
            Defrule rule;
            IList dec = new ArrayList();
            IList conditions = new ArrayList();
            IList actions = new ArrayList();
            exp = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
            if (jj_2_12(2147483647))
            {
                rulecomment = jj_consume_token(CLIPSParserConstants_Fields.STRING_LITERAL);
            }
            else
            {
                ;
            }
            if (jj_2_13(2147483647))
            {
                ruleDeclaration(dec);
            }
            else
            {
                ;
            }
            switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
            {
                case CLIPSParserConstants_Fields.LBRACE:
                case CLIPSParserConstants_Fields.BIND:
                    while (true)
                    {
                        conditionElement(conditions);
                        switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                        {
                            case CLIPSParserConstants_Fields.LBRACE:
                            case CLIPSParserConstants_Fields.BIND:
                                ;
                                break;

                            default:
                                jj_la1[32] = jj_gen;
                                //UPGRADE_NOTE: Labeled break statement was changed to a goto statement. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1012"'
                                goto label_17_brk;
                        }
                    }
                    //UPGRADE_NOTE: Label 'label_17_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                    label_17_brk:
                    ;

                    break;

                default:
                    jj_la1[33] = jj_gen;
                    ;
                    break;
            }
            arrow();
            ruleActions(actions);
            rule = new Defrule(exp.image);
            if (rulecomment != null)
            {
                rule.Comment = rulecomment.image;
            }
            rule.setRuleProperties(dec);
            IEnumerator itr = conditions.GetEnumerator();
            while (itr.MoveNext())
            {
                rule.addCondition((ICondition) itr.Current);
            }

            itr = actions.GetEnumerator();
            while (itr.MoveNext())
            {
                Object acn = itr.Current;
                if (acn is IFunction)
                {
                    FunctionAction faction = new FunctionAction();
                    faction.Function = (IFunction) acn;
                    rule.addAction(faction);
                }
                else if (acn is IAction)
                {
                    rule.addAction((IAction) acn);
                }
            }
            dec.Clear();
            conditions.Clear();
            actions.Clear();
            exp = null;
            {
                if (true)
                    return rule;
            }
            throw new ApplicationException("Missing return statement in function");
        }
Example #4
0
        public Defrule ruleBody()
        {
            Token exp = null;
            Token rulecomment = null;
            Defrule rule;
            ArrayList dec = new ArrayList();
            ArrayList conditions = new ArrayList();
            ArrayList actions = new ArrayList();
            exp = mcc_consume_token(IDENTIFIER);
            if (mcc_2_12(2147483647))
            {
                rulecomment = mcc_consume_token(STRING_LITERAL);
            }
            else
            {
                ;
            }
            if (mcc_2_13(2147483647))
            {
                ruleDeclaration(dec);
            }
            else
            {
                ;
            }
            switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
            {
                case LBRACE:
                case BIND:
                    while (true)
                    {
                        conditionElement(conditions);
                        switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                        {
                            case LBRACE:
                            case BIND:
                                ;
                                break;
                            default:
                                mcc_la1[32] = mcc_gen;
                                goto label_17;
                        }
                    }
                    label_17:
                    ;

                    break;
                default:
                    mcc_la1[33] = mcc_gen;
                    ;
                    break;
            }
            arrow();
            ruleActions(actions);
            rule = new Defrule(exp.image);
            if (rulecomment != null)
            {
                rule.Comment = rulecomment.image;
            }
            rule.setRuleProperties(dec);
            IEnumerator itrC = conditions.GetEnumerator();
            while (itrC.MoveNext())
            {
                rule.addCondition((ICondition) itrC.Current);
            }

            IEnumerator itr = actions.GetEnumerator();
            while (itr.MoveNext())
            {
                Object acn = itr.Current;
                if (acn is IFunction)
                {
                    FunctionAction faction = new FunctionAction();
                    faction.Function = (IFunction) acn;
                    rule.addAction(faction);
                }
                else if (acn is IAction)
                {
                    rule.addAction((IAction) acn);
                }
            }
            dec.Clear();
            conditions.Clear();
            actions.Clear();
            exp = null;
            {
                if (true) return rule;
            }
            throw new Exception("Missing return statement in function");
        }