Exemple #1
0
        private bool compNodeSetNumerical(Expr left, Expr right, VTDNav vn, int op)
        {
            int    i, i1 = 0, stackSize;
            double d;

            try {
                d = right.evalNumber(vn);
                vn.push2();
                stackSize = vn.contextStack2.size;
                while ((i = left.evalNodeSet(vn)) != -1)
                {
                    //i1 = getStringVal(vn,i);
                    if (compareVNumber2(i, vn, d, op))
                    {
                        left.reset(vn);
                        vn.contextStack2.size = stackSize;
                        vn.pop2();
                        return(true);
                    }
                }
                vn.contextStack2.size = stackSize;
                vn.pop2();
                left.reset(vn);
                return(false);
            } catch (Exception e) {
                throw new System.SystemException("Undefined behavior");
            }
        }
Exemple #2
0
        public override int evalNodeSet(VTDNav vn)
        {
            // if tne predicate require context size
            // needs to precompute the context size
            // vn.push2();
            // computerContext();
            // set contxt();
            // vn.pop2()
            // if the context size is zero
            // get immediately set teh state to end
            // or backward
            if (first_time && p.requireContext)
            {
                first_time = false;
                int i = 0;
                //vn.push2();
                e.adjust(vn.getTokenCount());
                while (e.evalNodeSet(vn) != -1)
                {
                    i++;
                }
                //vn.pop2();
                p.ContextSize = i;
                reset2(vn);
            }
            if (out_of_range)
            {
                return(-1);
            }
            int a = e.evalNodeSet(vn);

            while (a != -1)
            {
                if (p.eval(vn) == true)
                {
                    //p.reset();
                    return(a);
                }
                else
                {
                    //p.reset();
                    a = e.evalNodeSet(vn);
                }
            }
            return(-1);
        }
Exemple #3
0
        private bool compNodeSetNodeSet(Expr left, Expr right, VTDNav vn, int op)
        {
            int i, i1 = 0, stackSize, s1;

            try
            {
                if (fib1 == null)
                {
                    fib1 = new FastIntBuffer(BUF_SZ_EXP);
                }
                vn.push2();
                stackSize = vn.contextStack2.size;
                while ((i = left.evalNodeSet(vn)) != -1)
                {
                    i1 = getStringVal(vn, i);
                    if (i1 != -1)
                    {
                        fib1.append(i1);
                    }
                }
                left.reset(vn);
                vn.contextStack2.size = stackSize;
                vn.pop2();
                vn.push2();
                stackSize = vn.contextStack2.size;
                while ((i = right.evalNodeSet(vn)) != -1)
                {
                    i1 = getStringVal(vn, i);
                    if (i1 != -1)
                    {
                        s1 = fib1.size_Renamed_Field;
                        for (int k = 0; k < s1; k++)
                        {
                            bool b = compareVV(fib1.intAt(k), vn, i1, op);
                            if (b)
                            {
                                fib1.size_Renamed_Field = 0;
                                vn.contextStack2.size   = stackSize;
                                vn.pop2();
                                right.reset(vn);
                                return(true);
                            }
                        }
                    }
                }
                vn.contextStack2.size = stackSize;
                vn.pop2();
                right.reset(vn);
                fib1.size_Renamed_Field = 0;
                return(false);
            }
            catch (Exception e)
            {
                fib1.size_Renamed_Field = 0;
                throw new System.SystemException("Undefined behavior");
            }
        }
Exemple #4
0
        private bool compNodeSetString(Expr left, Expr right, VTDNav vn, int op)
        {
            int    i, i1 = 0, stackSize;
            String s;

            try
            {
                s = right.evalString(vn);
                vn.push2();
                stackSize = vn.contextStack2.size;
                while ((i = left.evalNodeSet(vn)) != -1)
                {
                    int t = vn.getTokenType(i);
                    if (t != VTDNav.TOKEN_STARTING_TAG &&
                        t != VTDNav.TOKEN_DOCUMENT)
                    {
                        i1 = getStringVal(vn, i);
                        // if (i1==-1 && s.length()==0)
                        //return true;
                        if (i1 != -1)
                        {
                            bool b = compareVString1(i1, vn, s, op);
                            if (b)
                            {
                                left.reset(vn);
                                vn.contextStack2.size = stackSize;
                                vn.pop2();
                                return(b);
                            }
                        }
                    }
                    else
                    {
                        bool b = vn.XPathStringVal_Matches(i, s);
                        if (b)
                        {
                            left.reset(vn);
                            vn.contextStack2.size = stackSize;
                            vn.pop2();
                            return(b);
                        }
                    }
                }
                vn.contextStack2.size = stackSize;
                vn.pop2();
                left.reset(vn);
                return(false); // compareEmptyNodeSet(op, s);
            }
            catch (Exception e)
            {
                throw new System.SystemException("Undefined behavior");
            }
        }
Exemple #5
0
        public override int evalNodeSet(VTDNav vn)
        {
            int a;

            while (true)
            {
                switch (evalState)
                {
                case 0:                          //this state is teh initial state;
                    a = fe.evalNodeSet(vn);
                    if (a == -1)
                    {
                        evalState = 4;
                    }
                    else
                    {
                        evalState = 1;
                    }
                    break;

                case 1:                          // fe returns valid value, then iterate the locationPath
                    vn.push2();
                    a = lpe.evalNodeSet(vn);
                    if (a == -1)
                    {
                        lpe.reset(vn);
                        evalState = 3;
                    }
                    else
                    {
                        evalState = 2;
                        if (isUnique(a))
                        {
                            return(a);
                        }
                    }
                    break;

                case 2:
                    a = lpe.evalNodeSet(vn);
                    if (a == -1)
                    {
                        lpe.reset(vn);
                        evalState = 3;
                    }
                    else
                    {
                        if (isUnique(a))
                        {
                            return(a);
                        }
                        //return a;
                    }
                    break;

                case 3:
                    vn.pop2();
                    a = fe.evalNodeSet(vn);
                    if (a == -1)
                    {
                        evalState = 4;
                    }
                    else
                    {
                        vn.push2();
                        evalState = 2;
                    }
                    break;

                case 4:
                    return(-1);

                default:
                    throw new XPathEvalException("Invalid state evaluating PathExpr");
                }
            }
            //return -1;
        }
Exemple #6
0
    private bool compStringNodeSet(Expr left, Expr right, VTDNav vn, int op)
    {
        int i, i1 = 0, stackSize;
        String s;
        try
        {
            s = left.evalString(vn);
            vn.push2();
            stackSize = vn.contextStack2.size;
            while ((i = right.evalNodeSet(vn)) != -1)
            {
                    int t = vn.getTokenType(i);
                    if (t != VTDNav.TOKEN_STARTING_TAG
                            && t != VTDNav.TOKEN_DOCUMENT)
                    {

                        i1 = getStringVal(vn, i);
                        if (i1 != -1)
                        {
                            bool b = compareVString2(i1, vn, s, op);
                            if (b)
                            {
                                right.reset(vn);
                                vn.contextStack2.size = stackSize;
                                vn.pop2();
                                return b;
                            }
                        }
                    }
                    else
                    {
                        bool b = vn.XPathStringVal_Matches(i, s);
                        if (b)
                        {
                            right.reset(vn);
                            vn.contextStack2.size = stackSize;
                            vn.pop2();
                            return b;
                        }
                    }
                }
            vn.contextStack2.size = stackSize;
            vn.pop2();
            right.reset(vn);
            return false;// compareEmptyNodeSet(op, s);
        }
        catch (Exception e)
        {
            throw new System.SystemException("Undefined behavior");
        }
    }
Exemple #7
0
	private bool compNodeSetNumerical(Expr left, Expr right, VTDNav vn, int op ){
	     int i, i1 = 0, stackSize;
	     double d;
       try {
           d = right.evalNumber(vn);
           vn.push2();
           stackSize = vn.contextStack2.size;
           while ((i = left.evalNodeSet(vn)) != -1) {
               //i1 = getStringVal(vn,i); 
               if (compareVNumber2(i,vn,d,op)){
                   left.reset(vn);
                   vn.contextStack2.size = stackSize;
                   vn.pop2();
                   return true;
               }
           }    
           vn.contextStack2.size = stackSize;
           vn.pop2();
           left.reset(vn);            
           return false; 
       } catch (Exception e) {
           throw new System.SystemException("Undefined behavior");
       }
	}
Exemple #8
0
 private bool compNodeSetNodeSet(Expr left, Expr right, VTDNav vn, int op)
 {
     int i, i1 = 0, stackSize, s1;
     try
     {
         if (fib1 == null)
             fib1 = new FastIntBuffer(BUF_SZ_EXP);
         vn.push2();
         stackSize = vn.contextStack2.size;
         while ((i = left.evalNodeSet(vn)) != -1)
         {
             i1 = getStringVal(vn, i);
             if (i1 != -1)
                 fib1.append(i1);
         }
         left.reset(vn);
         vn.contextStack2.size = stackSize;
         vn.pop2();
         vn.push2();
         stackSize = vn.contextStack2.size;
         while ((i = right.evalNodeSet(vn)) != -1)
         {
             i1 = getStringVal(vn, i);
             if (i1 != -1)
             {
                 s1 = fib1.size_Renamed_Field;
                 for (int k = 0; k < s1; k++)
                 {
                     bool b = compareVV(fib1.intAt(k), vn, i1, op);
                     if (b)
                     {
                         fib1.size_Renamed_Field=0;
                         vn.contextStack2.size = stackSize;
                         vn.pop2();
                         right.reset(vn);
                         return true;
                     }
                 }
             }
         }
         vn.contextStack2.size = stackSize;
         vn.pop2();
         right.reset(vn);
         fib1.size_Renamed_Field=0;
         return false;
     }
     catch (Exception e)
     {
         fib1.size_Renamed_Field=0;
         throw new System.SystemException("Undefined behavior");
     }
 }
Exemple #9
0
 private bool compStringNodeSet(Expr left, Expr right, VTDNav vn, int op)
 {
     int i, i1 = 0, stackSize;
     String s;
     try
     {
     s = left.evalString(vn);
     vn.push2();
     stackSize = vn.contextStack2.size;
     while ((i = right.evalNodeSet(vn)) != -1)
     {
         i1 = getStringVal(vn, i);
         if (i1 != -1)
         {
             bool b = compareVString2(i1, vn, s, op);
             if (b)
             {
                 right.reset(vn);
                 vn.contextStack2.size = stackSize;
                 vn.pop2();
                 return b;
             }
         }
     }
     vn.contextStack2.size = stackSize;
     vn.pop2();
     right.reset(vn);
     return false;// compareEmptyNodeSet(op, s);
     }
     catch (Exception e)
     {
     throw new System.SystemException("Undefined behavior");
     }
 }