public virtual String toPPString()
        {
            StringBuilder buf = new StringBuilder();
            IEnumerator   itr = value_Renamed.GetEnumerator();

            buf.Append("    (" + name + " ");
            int count = 0;

            while (itr.MoveNext())
            {
                MultiValue mv = (MultiValue)itr.Current;
                if (count > 0)
                {
                    buf.Append("&");
                }
                if (mv.Negated)
                {
                    buf.Append("~" + ConversionUtils.formatSlot(mv.Value));
                }
                else
                {
                    buf.Append(ConversionUtils.formatSlot(mv.Value));
                }
                count++;
            }
            buf.Append(")" + Constants.LINEBREAK);
            return(buf.ToString());
        }
Esempio n. 2
0
        public void andType(IList list)
        {
            Token body = null;
            Object val = null;
            MultiValue mv = null;
            if (jj_2_37(2147483647))
            {
                body = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                if (body != null)
                {
                    mv = new MultiValue(body.image);
                    list.Add(mv);
                }
            }
            else if (jj_2_38(2147483647))
            {
                jj_consume_token(CLIPSParserConstants_Fields.TILDA);
                val = typeExpr();
                if (val != null)
                {
                    mv = new MultiValue(val, true);
                    list.Add(mv);
                }
            }
            else
            {
                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                {
                    case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                    case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                    case CLIPSParserConstants_Fields.STRING_LITERAL:
                    case CLIPSParserConstants_Fields.PATH_LITERAL:
                        val = typeExpr();
                        if (val != null)
                        {
                            mv = new MultiValue(val);
                            list.Add(mv);
                        }
                        break;

                    default:
                        jj_la1[54] = jj_gen;
                        jj_consume_token(- 1);
                        throw new ParseException();
                }
            }
        }
Esempio n. 3
0
        public void propertyType(IList list, Token identifier)
        {
            Token id = null;
            Object body = null;
            Token body2 = null;
            bool bval = false;
            LiteralConstraint vc;
            BoundConstraint bc;
            OrLiteralConstraint orc;
            AndLiteralConstraint andc;
            //UPGRADE_TODO: Field java.util was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1095"'
            IList andor = new ArrayList();
            MultiValue mv = null;
            if (jj_2_26(2147483647))
            {
                predicateFunc(list, identifier);
            }
            else if (jj_2_27(2147483647))
            {
                body2 = jj_consume_token(CLIPSParserConstants_Fields.BIND4);
                if (body2 != null)
                {
                    bc = new BoundConstraint();
                    bc.Name = identifier.image;
                    bc.Value = body2.image.Substring(2);
                    bc.IsMultislot = true;
                    list.Add(bc);
                }
            }
            else if (jj_2_28(2147483647))
            {
                body2 = jj_consume_token(CLIPSParserConstants_Fields.BIND);
                if (body2 != null)
                {
                    bc = new BoundConstraint();
                    bc.Name = identifier.image;
                    bc.Value = body2.image.Substring(1);
                    list.Add(bc);
                }
            }
            else if (jj_2_29(2147483647))
            {
                jj_consume_token(CLIPSParserConstants_Fields.TILDA);
                body2 = jj_consume_token(CLIPSParserConstants_Fields.BIND);
                if (body2 != null)
                {
                    bc = new BoundConstraint();
                    bc.Name = identifier.image;
                    bc.Value = body2.image.Substring(1);
                    bc.Negated = true;
                    list.Add(bc);
                }
            }
            else if (jj_2_30(2147483647))
            {
                body = typeExpr();
                while (true)
                {
                    jj_consume_token(CLIPSParserConstants_Fields.OR2);
                    orType(andor);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.OR2:
                            ;
                            break;

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

                if (body != null)
                {
                    orc = new OrLiteralConstraint();
                    orc.Name = identifier.image;
                    mv = new MultiValue(body);
                    orc.addValue(mv);
                    orc.addValues(andor);
                    list.Add(orc);
                }
            }
            else if (jj_2_31(2147483647))
            {
                jj_consume_token(CLIPSParserConstants_Fields.TILDA);
                body = typeExpr();
                while (true)
                {
                    jj_consume_token(CLIPSParserConstants_Fields.OR2);
                    orType(andor);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.OR2:
                            ;
                            break;

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

                if (body != null)
                {
                    orc = new OrLiteralConstraint();
                    orc.Name = identifier.image;
                    mv = new MultiValue(body);
                    mv.Negated = true;
                    orc.addValue(mv);
                    orc.addValues(andor);
                    list.Add(orc);
                }
            }
            else if (jj_2_32(2147483647))
            {
                body = typeExpr();
                while (true)
                {
                    jj_consume_token(CLIPSParserConstants_Fields.AND2);
                    andType(andor);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.AND2:
                            ;
                            break;

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

                if (body != null)
                {
                    andc = new AndLiteralConstraint();
                    andc.Name = identifier.image;
                    mv = new MultiValue(body);
                    andc.addValue(mv);
                    andc.addValues(andor);
                    list.Add(andc);
                }
            }
            else if (jj_2_33(2147483647))
            {
                jj_consume_token(CLIPSParserConstants_Fields.TILDA);
                body = typeExpr();
                while (true)
                {
                    jj_consume_token(CLIPSParserConstants_Fields.AND2);
                    andType(andor);
                    switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                    {
                        case CLIPSParserConstants_Fields.AND2:
                            ;
                            break;

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

                if (body != null)
                {
                    andc = new AndLiteralConstraint();
                    andc.Name = identifier.image;
                    mv = new MultiValue(body);
                    mv.Negated = true;
                    andc.addValue(mv);
                    andc.addValues(andor);
                    list.Add(andc);
                }
            }
            else if (jj_2_34(2147483647))
            {
                jj_consume_token(CLIPSParserConstants_Fields.TILDA);
                body = typeExpr();
                if (body != null)
                {
                    vc = new LiteralConstraint();
                    vc.Name = identifier.image;
                    vc.Value = body;
                    vc.Negated = true;
                    list.Add(vc);
                }
            }
            else if (jj_2_35(2147483647))
            {
                id = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                if (id != null)
                {
                    vc = new LiteralConstraint();
                    vc.Name = identifier.image;
                    vc.Value = id.image;
                    list.Add(vc);
                }
            }
            else if (jj_2_36(2147483647))
            {
                jj_consume_token(CLIPSParserConstants_Fields.TILDA);
                id = jj_consume_token(CLIPSParserConstants_Fields.IDENTIFIER);
                if (id != null)
                {
                    vc = new LiteralConstraint();
                    vc.Name = identifier.image;
                    vc.Value = id.image;
                    vc.Negated = true;
                    list.Add(vc);
                }
            }
            else
            {
                switch ((jj_ntk_Renamed_Field == - 1) ? jj_ntk() : jj_ntk_Renamed_Field)
                {
                    case CLIPSParserConstants_Fields.INTEGER_LITERAL:
                    case CLIPSParserConstants_Fields.FLOATING_POINT_LITERAL:
                    case CLIPSParserConstants_Fields.STRING_LITERAL:
                    case CLIPSParserConstants_Fields.PATH_LITERAL:
                        body = typeExpr();
                        if (body != null)
                        {
                            vc = new LiteralConstraint();
                            vc.Name = identifier.image;
                            vc.Value = body;
                            list.Add(vc);
                        }
                        break;

                    case CLIPSParserConstants_Fields.TRUE:
                    case CLIPSParserConstants_Fields.TRUE2:
                    case CLIPSParserConstants_Fields.FALSE:
                    case CLIPSParserConstants_Fields.FALSE2:
                        bval = trueFalse();
                        vc = new LiteralConstraint();
                        vc.Name = identifier.image;
                        vc.Value = bval;
                        list.Add(vc);
                        break;

                    default:
                        jj_la1[53] = jj_gen;
                        jj_consume_token(- 1);
                        throw new ParseException();
                }
            }
        }
 public virtual void addValue(MultiValue mv)
 {
     value_Renamed.Add(mv);
 }
Esempio n. 5
0
        public void propertyType(ArrayList list, Token identifier)
        {
            Token id = null;
            Object body = null;
            Token body2 = null;
            bool bval = false;
            LiteralConstraint vc;
            BoundConstraint bc;
            OrLiteralConstraint orc;
            AndLiteralConstraint andc;
            ArrayList andor = new ArrayList();
            MultiValue mv = null;
            if (mcc_2_26(2147483647))
            {
                predicateFunc(list, identifier);
            }
            else if (mcc_2_27(2147483647))
            {
                body2 = mcc_consume_token(BIND4);
                if (body2 != null)
                {
                    bc = new BoundConstraint();
                    bc.Name = identifier.image;
                    bc.Value = body2.image.Substring(2);
                    bc.IsMultislot = true;
                    list.Add(bc);
                }
            }
            else if (mcc_2_28(2147483647))
            {
                body2 = mcc_consume_token(BIND);
                if (body2 != null)
                {
                    bc = new BoundConstraint();
                    bc.Name = identifier.image;
                    bc.Value = body2.image.Substring(1);
                    list.Add(bc);
                }
            }
            else if (mcc_2_29(2147483647))
            {
                mcc_consume_token(TILDA);
                body2 = mcc_consume_token(BIND);
                if (body2 != null)
                {
                    bc = new BoundConstraint();
                    bc.Name = identifier.image;
                    bc.Value = body2.image.Substring(1);
                    bc.Negated = true;
                    list.Add(bc);
                }
            }
            else if (mcc_2_30(2147483647))
            {
                body = typeExpr();
                while (true)
                {
                    mcc_consume_token(OR2);
                    orType(andor);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case OR2:
                            ;
                            break;
                        default:
                            mcc_la1[51] = mcc_gen;
                            goto label_25;
                    }
                }
                label_25:
                ;

                if (body != null)
                {
                    orc = new OrLiteralConstraint();
                    orc.Name = identifier.image;
                    mv = new MultiValue(body);
                    orc.addValue(mv);
                    orc.addValues(andor);
                    list.Add(orc);
                }
            }
            else if (mcc_2_31(2147483647))
            {
                mcc_consume_token(TILDA);
                body = typeExpr();
                while (true)
                {
                    mcc_consume_token(OR2);
                    orType(andor);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case OR2:
                            ;
                            break;
                        default:
                            mcc_la1[52] = mcc_gen;
                            goto label_26;
                    }
                }
                label_26:
                ;

                if (body != null)
                {
                    orc = new OrLiteralConstraint();
                    orc.Name = identifier.image;
                    mv = new MultiValue(body);
                    mv.Negated = true;
                    orc.addValue(mv);
                    orc.addValues(andor);
                    list.Add(orc);
                }
            }
            else if (mcc_2_32(2147483647))
            {
                body = bindTypeExpr();
                while (true)
                {
                    mcc_consume_token(AND2);
                    andType(andor);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case AND2:
                            ;
                            break;
                        default:
                            mcc_la1[53] = mcc_gen;
                            goto label_27;
                    }
                }
                label_27:
                ;

                if (body != null)
                {
                    if (body is String && ((String) body).StartsWith("?"))
                    {
                        bc = new BoundConstraint();
                        bc.Name = identifier.image;
                        bc.Value = ((String) body).Substring(1);
                        bc.IntraFactJoin = true;
                        bc.addIntrFactJoin(andor);
                        list.Add(bc);
                    }
                    else
                    {
                        andc = new AndLiteralConstraint();
                        andc.Name = identifier.image;
                        mv = new MultiValue(body);
                        andc.addValue(mv);
                        andc.addValues(andor);
                        list.Add(andc);
                    }
                }
            }
            else if (mcc_2_33(2147483647))
            {
                mcc_consume_token(TILDA);
                body = typeExpr();
                while (true)
                {
                    mcc_consume_token(AND2);
                    andType(andor);
                    switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                    {
                        case AND2:
                            ;
                            break;
                        default:
                            mcc_la1[54] = mcc_gen;
                            goto label_28;
                    }
                }
                label_28:
                ;

                if (body != null)
                {
                    andc = new AndLiteralConstraint();
                    andc.Name = identifier.image;
                    mv = new MultiValue(body);
                    mv.Negated = true;
                    andc.addValue(mv);
                    andc.addValues(andor);
                    list.Add(andc);
                }
            }
            else if (mcc_2_34(2147483647))
            {
                mcc_consume_token(TILDA);
                body = typeExpr();
                if (body != null)
                {
                    vc = new LiteralConstraint();
                    vc.Name = identifier.image;
                    vc.Value = body;
                    vc.Negated = true;
                    list.Add(vc);
                }
            }
            else if (mcc_2_35(2147483647))
            {
                id = mcc_consume_token(IDENTIFIER);
                if (id != null)
                {
                    vc = new LiteralConstraint();
                    vc.Name = identifier.image;
                    vc.Value = id.image;
                    list.Add(vc);
                }
            }
            else if (mcc_2_36(2147483647))
            {
                mcc_consume_token(TILDA);
                id = mcc_consume_token(IDENTIFIER);
                if (id != null)
                {
                    vc = new LiteralConstraint();
                    vc.Name = identifier.image;
                    vc.Value = id.image;
                    vc.Negated = true;
                    list.Add(vc);
                }
            }
            else
            {
                switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
                {
                    case INTEGER_LITERAL:
                    case FLOATING_POINT_LITERAL:
                    case STRING_LITERAL:
                    case PATH_LITERAL:
                        body = typeExpr();
                        if (body != null)
                        {
                            vc = new LiteralConstraint();
                            vc.Name = identifier.image;
                            vc.Value = body;
                            list.Add(vc);
                        }
                        break;
                    case TRUE:
                    case TRUE2:
                    case FALSE:
                    case FALSE2:
                        bval = trueFalse();
                        vc = new LiteralConstraint();
                        vc.Name = identifier.image;
                        vc.Value = Convert.ToBoolean(bval);
                        list.Add(vc);
                        break;
                    default:
                        mcc_la1[55] = mcc_gen;
                        mcc_consume_token(-1);
                        throw new ParseException();
                }
            }
        }
Esempio n. 6
0
 // need to enhance to handling bindings
 public void andType(ArrayList list)
 {
     Token body = null;
     Object val = null;
     MultiValue mv = null;
     BoundConstraint bc;
     if (mcc_2_39(2147483647))
     {
         body = mcc_consume_token(IDENTIFIER);
         if (body != null)
         {
             mv = new MultiValue(body.image);
             list.Add(mv);
         }
     }
     else if (mcc_2_40(2147483647))
     {
         mcc_consume_token(TILDA);
         val = typeExpr();
         if (val != null)
         {
             mv = new MultiValue(val, true);
             list.Add(mv);
         }
     }
     else
     {
         switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
         {
             case BIND:
                 // a binding ?bind
                 body = mcc_consume_token(BIND);
                 bc = new BoundConstraint();
                 bc.Value = body.image.Substring(1);
                 list.Add(bc);
                 break;
             case TILDA:
                 mcc_consume_token(TILDA);
                 body = mcc_consume_token(BIND);
                 bc = new BoundConstraint();
                 bc.Value = body.image.Substring(1);
                 bc.Negated = true;
                 list.Add(bc);
                 break;
             case INTEGER_LITERAL:
             case FLOATING_POINT_LITERAL:
             case STRING_LITERAL:
             case PATH_LITERAL:
                 val = typeExpr();
                 if (val != null)
                 {
                     mv = new MultiValue(val);
                     list.Add(mv);
                 }
                 break;
             default:
                 mcc_la1[56] = mcc_gen;
                 mcc_consume_token(-1);
                 throw new ParseException();
         }
     }
 }
Esempio n. 7
0
 public void orType(ArrayList list)
 {
     Token body = null;
     Object val = null;
     MultiValue mv = null;
     if (mcc_2_41(2147483647))
     {
         body = mcc_consume_token(IDENTIFIER);
         if (body != null)
         {
             mv = new MultiValue(body.image);
             list.Add(mv);
         }
     }
     else if (mcc_2_42(2147483647))
     {
         mcc_consume_token(TILDA);
         val = typeExpr();
         if (val != null)
         {
             mv = new MultiValue(val, true);
             list.Add(mv);
         }
     }
     else
     {
         switch ((mcc_ntk == -1) ? mcc_mntk() : mcc_ntk)
         {
             case INTEGER_LITERAL:
             case FLOATING_POINT_LITERAL:
             case STRING_LITERAL:
             case PATH_LITERAL:
                 val = typeExpr();
                 if (val != null)
                 {
                     mv = new MultiValue(val);
                     list.Add(mv);
                 }
                 break;
             default:
                 mcc_la1[57] = mcc_gen;
                 mcc_consume_token(-1);
                 throw new ParseException();
         }
     }
 }
Esempio n. 8
0
 public virtual void addValue(MultiValue mv)
 {
     value_Renamed.Add(mv);
 }