Пример #1
0
        public void CEType(IList list)
        {
            Token exp;
            Token exp2;
            Object etime;
            Object nested = null;
            IList alpha = new ArrayList();
            ObjectCondition oc = null;
            TemporalCondition tmpc = null;
            if (jj_2_24(2147483647))
            {
                jj_consume_token(CLIPSParserConstants_Fields.NOTCE);
                jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                exp = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                {
                    case CLIPSParserConstants_Fields.LBRACE:
                        while (true)
                        {
                            templatePatterns(alpha);
                            switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                            {
                                case CLIPSParserConstants_Fields.LBRACE:
                                    ;
                                    break;

                                default:
                                    jj_la1[37] = 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_18_brk;
                            }
                        }
                        //UPGRADE_NOTE: Label 'label_18_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                        label_18_brk:
                        ;

                        break;

                    default:
                        jj_la1[38] = jj_gen;
                        ;
                        break;
                }
                jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                oc = new ObjectCondition();
                oc.Negated = true;
                oc.TemplateName = exp.image;
                IEnumerator itr = alpha.GetEnumerator();
                while (itr.MoveNext())
                {
                    oc.addConstraint((IConstraint) itr.Current);
                }
                list.Add(oc);
                alpha.Clear();
                exp = null;
            }
            else
            {
                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                {
                    case CLIPSParserConstants_Fields.NOTCE:
                        jj_consume_token(CLIPSParserConstants_Fields.NOTCE);
                        jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                        nested = expr();
                        jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                        TestCondition tc = new TestCondition();
                        tc.Negated = true;
                        if (nested is IFunction)
                        {
                            tc.Function = (IFunction) nested;
                        }
                        list.Add(tc);
                        break;

                    default:
                        jj_la1[47] = jj_gen;
                        if (jj_2_25(2147483647))
                        {
                            jj_consume_token(CLIPSParserConstants_Fields.TEMPORAL);
                            jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                            jj_consume_token(CLIPSParserConstants_Fields.RELATIVETIME);
                            etime = typeExpr();
                            jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                            jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                            jj_consume_token(CLIPSParserConstants_Fields.NOTCE);
                            jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                            exp = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                            switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                            {
                                case CLIPSParserConstants_Fields.LBRACE:
                                    while (true)
                                    {
                                        templatePatterns(alpha);
                                        switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                        {
                                            case CLIPSParserConstants_Fields.LBRACE:
                                                ;
                                                break;

                                            default:
                                                jj_la1[39] = 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_19_brk;
                                        }
                                    }
                                    //UPGRADE_NOTE: Label 'label_19_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                                    label_19_brk:
                                    ;

                                    break;

                                default:
                                    jj_la1[40] = jj_gen;
                                    ;
                                    break;
                            }
                            jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                            jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                            tmpc = new TemporalCondition();
                            tmpc.TemplateName = exp.image;
                            tmpc.Negated = true;
                            if (etime is Decimal)
                            {
                                tmpc.RelativeTime = Decimal.ToInt32(((Decimal) etime));
                            }
                            IEnumerator itr = alpha.GetEnumerator();
                            while (itr.MoveNext())
                            {
                                tmpc.addConstraint((IConstraint) itr.Current);
                            }
                            list.Add(tmpc);
                            alpha.Clear();
                            exp = null;
                        }
                        else
                        {
                            switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                            {
                                case CLIPSParserConstants_Fields.TEMPORAL:
                                    jj_consume_token(CLIPSParserConstants_Fields.TEMPORAL);
                                    exp2 = jj_consume_token(CLIPSParserConstants_Fields.BIND);
                                    jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                                    jj_consume_token(CLIPSParserConstants_Fields.RELATIVETIME);
                                    etime = typeExpr();
                                    jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                                    jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                                    exp = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                    {
                                        case CLIPSParserConstants_Fields.LBRACE:
                                            while (true)
                                            {
                                                templatePatterns(alpha);
                                                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                                {
                                                    case CLIPSParserConstants_Fields.LBRACE:
                                                        ;
                                                        break;

                                                    default:
                                                        jj_la1[41] = 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_20_brk;
                                                }
                                            }
                                            //UPGRADE_NOTE: Label 'label_20_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                                            label_20_brk:
                                            ;

                                            break;

                                        default:
                                            jj_la1[42] = jj_gen;
                                            ;
                                            break;
                                    }
                                    jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                                    tmpc = new TemporalCondition();
                                    tmpc.TemplateName = exp.image;
                                    tmpc.VariableName = exp2.image.Substring(1);
                                    if (etime is Decimal)
                                    {
                                        tmpc.RelativeTime = Decimal.ToInt32(((Decimal) etime));
                                    }
                                    IEnumerator itr = alpha.GetEnumerator();
                                    while (itr.MoveNext())
                                    {
                                        tmpc.addConstraint((IConstraint) itr.Current);
                                    }
                                    list.Add(tmpc);
                                    alpha.Clear();
                                    exp = null;
                                    break;

                                case CLIPSParserConstants_Fields.TEST:
                                    jj_consume_token(CLIPSParserConstants_Fields.TEST);
                                    jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                                    nested = expr();
                                    jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                                    tc = new TestCondition();
                                    if (nested is IFunction)
                                    {
                                        tc.Function = (IFunction) nested;
                                    }
                                    list.Add(tc);
                                    break;

                                case CLIPSParserConstants_Fields.AND1:
                                    jj_consume_token(CLIPSParserConstants_Fields.AND1);
                                    while (true)
                                    {
                                        jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                                        nested = expr();
                                        jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                                        switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                        {
                                            case CLIPSParserConstants_Fields.LBRACE:
                                                ;
                                                break;

                                            default:
                                                jj_la1[43] = 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_21_brk;
                                        }
                                    }
                                    //UPGRADE_NOTE: Label 'label_21_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                                    label_21_brk:
                                    ;

                                    AndCondition ac = new AndCondition();
                                    ac.addNestedConditionElement(nested);
                                    list.Add(ac);
                                    break;

                                case CLIPSParserConstants_Fields.EXISTS:
                                    jj_consume_token(CLIPSParserConstants_Fields.EXISTS);
                                    while (true)
                                    {
                                        jj_consume_token(CLIPSParserConstants_Fields.LBRACE);
                                        CEType(alpha);
                                        jj_consume_token(CLIPSParserConstants_Fields.RBRACE);
                                        switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                        {
                                            case CLIPSParserConstants_Fields.LBRACE:
                                                ;
                                                break;

                                            default:
                                                jj_la1[44] = 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_22_brk;
                                        }
                                    }
                                    //UPGRADE_NOTE: Label 'label_22_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                                    label_22_brk:
                                    ;

                                    ExistCondition exc = null;
                                    if (alpha.Count > 1)
                                    {
                                        for (int iz = 0; iz < alpha.Count; iz++)
                                        {
                                            exc = ExistCondition.newExistCondition((ObjectCondition) alpha[iz]);
                                            list.Add(exc);
                                        }
                                    }
                                    else
                                    {
                                        exc = ExistCondition.newExistCondition((ObjectCondition) alpha[0]);
                                        list.Add(exc);
                                    }
                                    break;

                                case CLIPSParserConstants_Fields.IDENTIFIER:
                                    exp = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                    {
                                        case CLIPSParserConstants_Fields.LBRACE:
                                            while (true)
                                            {
                                                templatePatterns(alpha);
                                                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                                                {
                                                    case CLIPSParserConstants_Fields.LBRACE:
                                                        ;
                                                        break;

                                                    default:
                                                        jj_la1[45] = 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_23_brk;
                                                }
                                            }
                                            //UPGRADE_NOTE: Label 'label_23_brk' was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1011"'
                                            label_23_brk:
                                            ;

                                            break;

                                        default:
                                            jj_la1[46] = jj_gen;
                                            ;
                                            break;
                                    }
                                    oc = new ObjectCondition();
                                    oc.TemplateName = exp.image;
                                    itr = alpha.GetEnumerator();
                                    while (itr.MoveNext())
                                    {
                                        oc.addConstraint((IConstraint) itr.Current);
                                    }
                                    list.Add(oc);
                                    alpha.Clear();
                                    exp = null;
                                    break;

                                default:
                                    jj_la1[48] = jj_gen;
                                    jj_consume_token(- 1);
                                    throw new ParseException();
                            }
                        }
                        break;
                }
            }
        }
Пример #2
0
        // CEType checks the Conditional element to see if it's exist, not, test or plain
        public void CEType(ArrayList list)
        {
            Token exp;
            Token exp2;
            Object etime;
            Object nested = null;
            ArrayList alpha = new ArrayList();
            ObjectCondition oc = null;
            TemporalCondition tmpc = null;
            ArrayList parms = new ArrayList();
            if (mcc_2_24(2147483647))
            {
                mcc_consume_token(NOTCE);
                mcc_consume_token(LBRACE);
                exp = mcc_consume_token(IDENTIFIER);
                switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                {
                    case LBRACE:
                        while (true)
                        {
                            templatePatterns(alpha);
                            switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                            {
                                case LBRACE:
                                    ;
                                    break;
                                default:
                                    mcc_la1[37] = mcc_gen;
                                    goto label_18;
                            }
                        }
                        label_18:
                        ;

                        break;
                    default:
                        mcc_la1[38] = mcc_gen;
                        ;
                        break;
                }
                mcc_consume_token(RBRACE);
                oc = new ObjectCondition();
                oc.Negated = true;
                oc.TemplateName = exp.image;
                IEnumerator itr = alpha.GetEnumerator();
                while (itr.MoveNext())
                {
                    oc.addConstraint((IConstraint) itr.Current);
                }
                list.Add(oc);
                alpha.Clear();
                exp = null;
            }
            else
            {
                switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                {
                    case NOTCE:
                        mcc_consume_token(NOTCE);
                        mcc_consume_token(LBRACE);
                        nested = expr();
                        mcc_consume_token(RBRACE);
                        TestCondition tc = new TestCondition();
                        tc.Negated = true;
                        if (nested is IFunction)
                        {
                            tc.Function = ((IFunction) nested);
                        }
                        list.Add(tc);
                        break;
                    case TEMPORAL:
                        mcc_consume_token(TEMPORAL);
                        temporalPattern(list);

                        break;
                    case TEST:
                        mcc_consume_token(TEST);
                        mcc_consume_token(LBRACE);
                        nested = expr();
                        mcc_consume_token(RBRACE);
                        tc = new TestCondition();
                        if (nested is IFunction)
                        {
                            tc.Function = ((IFunction) nested);
                        }
                        list.Add(tc);
                        break;
                    case AND1:
                        mcc_consume_token(AND1);
                        while (true)
                        {
                            mcc_consume_token(LBRACE);
                            nested = expr();
                            mcc_consume_token(RBRACE);
                            switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                            {
                                case LBRACE:
                                    ;
                                    break;
                                default:
                                    mcc_la1[39] = mcc_gen;
                                    goto label_19;
                            }
                        }
                        label_19:
                        ;

                        AndCondition ac = new AndCondition();
                        ac.addNestedConditionElement(nested);
                        list.Add(ac);
                        break;
                    case EXISTS:
                        mcc_consume_token(EXISTS);
                        while (true)
                        {
                            mcc_consume_token(LBRACE);
                            CEType(alpha);
                            mcc_consume_token(RBRACE);
                            switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                            {
                                case LBRACE:
                                    ;
                                    break;
                                default:
                                    mcc_la1[40] = mcc_gen;
                                    goto label_20;
                            }
                        }
                        label_20:
                        ;

                        ExistCondition exc = null;
                        if (alpha.Count > 1)
                        {
                            for (int iz = 0; iz < alpha.Count; iz++)
                            {
                                exc = ExistCondition.newExistCondition((ObjectCondition) alpha[iz]);
                                list.Add(exc);
                            }
                        }
                        else
                        {
                            exc = ExistCondition.newExistCondition((ObjectCondition) alpha[0]);
                            list.Add(exc);
                        }
                        break;
                    case IDENTIFIER:
                        exp = mcc_consume_token(IDENTIFIER);
                        switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                        {
                            case LBRACE:
                                while (true)
                                {
                                    templatePatterns(alpha);
                                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                                    {
                                        case LBRACE:
                                            ;
                                            break;
                                        default:
                                            mcc_la1[41] = mcc_gen;
                                            goto label_21;
                                    }
                                }
                                label_21:
                                ;

                                break;
                            default:
                                mcc_la1[42] = mcc_gen;
                                ;
                                break;
                        }
                        oc = new ObjectCondition();
                        oc.TemplateName = exp.image;
                        IEnumerator itr = alpha.GetEnumerator();
                        while (itr.MoveNext())
                        {
                            oc.addConstraint((IConstraint) itr.Current);
                        }
                        list.Add(oc);
                        alpha.Clear();
                        exp = null;
                        break;
                    default:
                        mcc_la1[43] = mcc_gen;
                        mcc_consume_token(-1);
                        throw new ParseException();
                }
            }
        }