Esempio n. 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;
                }
            }
        }
Esempio n. 2
0
        public void temporalPattern(ArrayList list)
        {
            Token exp;
            Token exp2;
            Object etime;
            Object itime;
            Object nested = null;
            ArrayList alpha = new ArrayList();
            ObjectCondition oc = null;
            TemporalCondition tmpc = null;
            ArrayList parms = new ArrayList();
            if (mcc_2_25(2147483647))
            {
                exp2 = mcc_consume_token(BIND);
                mcc_consume_token(LBRACE);
                mcc_consume_token(RELATIVETIME);
                etime = typeExpr();
                mcc_consume_token(RBRACE);
                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[44] = mcc_gen;
                                    goto label_22;
                            }
                        }
                        label_22:
                        ;

                        break;
                    default:
                        mcc_la1[45] = mcc_gen;
                        ;
                        break;
                }
                mcc_consume_token(RBRACE);
                tmpc = new TemporalCondition();
                tmpc.TemplateName = exp.image;
                tmpc.VariableName = exp2.image.Substring(1);
                if (etime is Decimal)
                {
                    tmpc.RelativeTime = Convert.ToInt32(etime);
                }
                IEnumerator itr = alpha.GetEnumerator();
                while (itr.MoveNext())
                {
                    tmpc.addConstraint((IConstraint) itr.Current);
                }
                list.Add(tmpc);
                alpha.Clear();
                exp = null;
            }
            else
            {
                switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                {
                    case BIND:
                        // (temporal ?binding (interval-time n) (relative-time n) (person (name "me") ) )
                        exp2 = mcc_consume_token(BIND);
                        mcc_consume_token(LBRACE);
                        mcc_consume_token(INTERVALTIME);
                        itime = typeExpr();
                        switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                        {
                            case LBRACE:
                                mcc_consume_token(LBRACE);
                                while (true)
                                {
                                    valueParams(parms);
                                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                                    {
                                        case LBRACE:
                                        case INTEGER_LITERAL:
                                        case FLOATING_POINT_LITERAL:
                                        case STRING_LITERAL:
                                        case BIND:
                                        case BIND3:
                                        case BIND4:
                                        case TRUE:
                                        case TRUE2:
                                        case FALSE:
                                        case FALSE2:
                                        case IDENTIFIER:
                                        case PATH_LITERAL:
                                            ;
                                            break;
                                        default:
                                            mcc_la1[46] = mcc_gen;
                                            goto label_23;
                                    }
                                }
                                label_23:
                                ;

                                mcc_consume_token(RBRACE);
                                break;
                            default:
                                mcc_la1[47] = mcc_gen;
                                ;
                                break;
                        }
                        mcc_consume_token(RBRACE);
                        mcc_consume_token(LBRACE);
                        mcc_consume_token(RELATIVETIME);
                        etime = typeExpr();
                        mcc_consume_token(RBRACE);
                        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[48] = mcc_gen;
                                            goto label_24;
                                    }
                                }
                                label_24:
                                ;

                                break;
                            default:
                                mcc_la1[49] = mcc_gen;
                                ;
                                break;
                        }
                        mcc_consume_token(RBRACE);
                        tmpc = new TemporalCondition();
                        tmpc.TemplateName = exp.image;
                        tmpc.VariableName = exp2.image.Substring(1);
                        if (itime is Decimal)
                        {
                            tmpc.IntervalTime = Convert.ToInt32(itime);
                        }
                        if (etime is Decimal)
                        {
                            tmpc.RelativeTime = Convert.ToInt32(etime);
                        }
                        tmpc.AddFunction(parms);
                        IEnumerator itr = alpha.GetEnumerator();
                        while (itr.MoveNext())
                        {
                            tmpc.addConstraint((IConstraint) itr.Current);
                        }
                        list.Add(tmpc);
                        alpha.Clear();
                        exp = null;
                        break;
                    default:
                        mcc_la1[50] = mcc_gen;
                        mcc_consume_token(-1);
                        throw new ParseException();
                }
            }
        }