当前位置: 首页>>代码示例>>C#>>正文


C# VTDNav.getCurrentIndex2方法代码示例

本文整理汇总了C#中com.ximpleware.VTDNav.getCurrentIndex2方法的典型用法代码示例。如果您正苦于以下问题:C# VTDNav.getCurrentIndex2方法的具体用法?C# VTDNav.getCurrentIndex2怎么用?C# VTDNav.getCurrentIndex2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ximpleware.VTDNav的用法示例。


在下文中一共展示了VTDNav.getCurrentIndex2方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: process_self

        private int process_self(VTDNav vn)
        {
            bool b1 = false;
            Predicate t = null;
            int result;
            switch (state)
            {
                case START:
                case FORWARD:
                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                        else
                            state = END;
                        break;
                    }
                    if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                    {
                        if (currentStep.nextS != null)
                        {
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        }
                        else
                        {
                            state = TERMINAL;
                            if (vn.atTerminal)
                                result = vn.LN;
                            else
                                result = vn.getCurrentIndex2();
                            if (isUnique(result))
                                return result;
                        }
                    }
                    else
                    {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if (state == START)
                            state = END;
                        else
                            state = BACKWARD;
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                case TERMINAL:
                    if (currentStep.prevS != null)
                    {
                        state = BACKWARD;
                        currentStep = currentStep.prevS;
                    }
                    else
                    {
                        state = END;
                    }
                    break;

                default:
                    throw new XPathEvalException("unknown state");
            }
            return -2;
        }
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:89,代码来源:LocationPathExpr.cs

示例2: process_ancestor2

        protected internal int process_ancestor2( VTDNav vn)
        {
            int result;
            bool b = false, b1 = false;
            //int contextSize;
            Predicate t= null;

            switch(state){
            case START:

                t = currentStep.p;
                while (t != null) {
                    if (t.requireContext) {
                        int i = computeContextSize( t, vn);
                        if (i == 0) {
                            b1 = true;
                            break;
                        } else
                            t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1) {
                    state = END;
                    break;
                }

                state = END;
                //if (vn.getCurrentDepth() != -1) {
                    vn.push2();

                    while (vn.toNode(VTDNav.P)) {
                        if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                            if (currentStep.nextS != null) {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                break;
                            } else {
                                //vn.pop();
                                state = TERMINAL;
                                result = vn.getCurrentIndex2();
                                if (isUnique(result))
                                    return result;
                            }
                        }
                    }
                    if (state == END) {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                    }
               // }
                break;

            case END:
                currentStep =null;
                // reset();
                return -1;

            case FORWARD:
                 t = currentStep.p;
                 while(t!=null){
                    if (t.requireContext){
                         int i = computeContextSize(t,vn);
                         if (i==0){
                             b1 = true;
                             break;
                         }else
                             t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1){
                    currentStep = currentStep.prevS;
                    state = BACKWARD;
                    break;
                }
                state =  BACKWARD;
               	vn.push2();

               	while(vn.toNode(VTDNav.P)){
               		if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
               				&& ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
               			if (currentStep.nextS != null){
               				 state =  FORWARD;
               				currentStep = currentStep.nextS;
               				break;
               			}
               			else {
               				//vn.pop();
               				 state =  TERMINAL;
               				result = vn.getCurrentIndex2();
                            if ( isUnique(result))
                                return result;
               			}
               		}
               	}
               	if ( state == BACKWARD){
                    if (currentStep.hasPredicate)
//.........这里部分代码省略.........
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:101,代码来源:LocationPathExpr.cs

示例3: process_DDFP


//.........这里部分代码省略.........
                    b = false;
                    while (ap.iterate())
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            b = true;
                            break;
                        }
                    }
                    if (b == false)
                    {
                        vn.pop2();
                        //System.out.println("  --++ pop in //");
                        currentStep.ft = true;
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                    }
                    else
                    {
                        if (currentStep.nextS != null)
                        {
                            state = FORWARD;
                            currentStep = currentStep.nextS;
                        }
                        else
                        {
                            //vn.pop();
                            state = TERMINAL;
                            result = vn.getCurrentIndex2();
                            if (isUnique(result))
                                return result;
                        }
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                    //currentStep = currentStep.prevS;
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_DDFP(vn);
                        break;
                    }
                    ap = (AutoPilot)currentStep.o;
                    //vn.push();
                    //b = false;
                    while (ap.iterate())
                    {
                        if (!currentStep.hasPredicate || currentStep.evalPredicates(vn))
                        {
                            b = true;
                            break;
                        }
                    }
                    if (b)
                    {
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:67,代码来源:LocationPathExpr.cs

示例4: process_preceding_sibling

        private int process_preceding_sibling(VTDNav vn)
        {
            bool b = false, b1 = false;
            Predicate t = null;
            int result;
            switch (state)
            {
                case START:
                case FORWARD:
                    t = currentStep.p;
                    while (t != null)
                    {
                        if (t.requireContext)
                        {
                            int i = computeContextSize(t, vn);
                            if (i == 0)
                            {
                                b1 = true;
                                break;
                            }
                            else
                                t.ContextSize=(i);
                        }
                        t = t.nextP;
                    }
                    if (b1)
                    {
                        if (state == FORWARD)
                        {
                            state = BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                        else
                            state = END;
                        break;
                    }
                    if (state == START)
                        state = END;
                    else
                        state = BACKWARD;
                    vn.push2();
                    while (vn.toElement(VTDNav.PS))
                    {
                        if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                        {
                            if (currentStep.nextS != null)
                            {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                break;
                            }
                            else
                            {
                                state = TERMINAL;
                                result = vn.getCurrentIndex2();
                                if (isUnique(result))
                                    return result;
                            }
                        }
                    }
                    if(state == END)  {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                    }else if (state == BACKWARD)
                    {
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        vn.pop2();
                        currentStep = currentStep.prevS;
                    }
                    break;

                case END:
                    currentStep = null;
                    // reset();
                    return -1;

                case BACKWARD:
                    if (currentStep.out_of_range)
                    {
                        currentStep.out_of_range = false;
                        transition_preceding_sibling(vn);
                        break;
                    }
                    while (vn.toElement(VTDNav.PS))
                    {
                        if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)))
                        {
                            if (currentStep.nextS != null)
                            {
                                state = FORWARD;
                                currentStep = currentStep.nextS;
                                b = true;
                                break;
                            }
                            else
                            {
//.........这里部分代码省略.........
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:101,代码来源:LocationPathExpr.cs

示例5: process_child

        private int process_child(VTDNav vn)
        {
            int result;
            bool b = false, b1 = false;
            int k=1;
            Predicate t= null;
               // Console.WriteLine(" index-============= " + vn.getCurrentIndex());
               // Console.WriteLine(" depth ==============" + vn.getCurrentDepth());
            switch(state){
                case START:
                    //if (currentStep.nt.testType < NodeTest.TEXT){
                        // first search for any predicate that
                        // requires contextSize
                        // if so, compute its context size
                        // if size > 0
                        // set context
                        // if size ==0
                        // immediately set the state to backward or end
                        t = currentStep.p;
                        while(t!=null){
                            if (t.requireContext){
                                int i = computeContextSize(t,vn);
                                if (i==0){
                                    b1 = true;
                                    break;
                                }else
                                    t.ContextSize=(i);
                            }
                            t = t.nextP;
                        }
                        if (b1){
                            state = END;
                            break;
                        }

                         b=vn.toElement(VTDNav.FIRST_CHILD);
                         state =  END;
                         if (b ){
                         do {
                            if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                    && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                if (currentStep.nextS != null){
                                    //currentStep.position++;
                                    state =  FORWARD;
                                    currentStep = currentStep.nextS;
                                }
                                else {
                                    state =  TERMINAL;
                                    result = vn.getCurrentIndex2();
                                    if ( isUnique(result)){
                                        return result;
                                    }
                                }
                            break;
                            }
                        } while (vn.toElement(VTDNav.NS));
                        if (state == END)
                            vn.toElement(VTDNav.PARENT);
                     }

                    break;
                case END:
                    currentStep =null;
                    // reset();
                    return -1;

                case FORWARD:
                    //if (currentStep.nt.testType < NodeTest.TEXT){
                        t = currentStep.p;
                        while(t!=null){
                            if (t.requireContext){
                                int i = computeContextSize(t,vn);
                                if (i==0){
                                    b1 = true;
                                    break;
                                }else
                                    t.ContextSize=(i);
                            }
                            t = t.nextP;
                        }
                        if (b1){
                            currentStep = currentStep.prevS;
                            state = BACKWARD;
                            break;
                        }

               			 	state =  BACKWARD;
               			 	if (vn.toElement(VTDNav.FC)) {
                            do {
                                if ((currentStep.nt_eval || currentStep.nt.eval(vn))
                                        && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) {
                                    if (currentStep.nextS != null) {
                                         state =  FORWARD;
                                        currentStep = currentStep.nextS;
                                    } else {
                                         state =  TERMINAL;
                                        result = vn.getCurrentIndex2();
                                        if ( isUnique(result))
                                            return result;
                                    }
//.........这里部分代码省略.........
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:101,代码来源:LocationPathExpr.cs

示例6: process_parent2

        protected internal int process_parent2(VTDNav vn)
        {
            bool b1 = false;
            Predicate t= null;
            int result;
            switch ( state) {
            case  START:
            case  FORWARD:
                t = currentStep.p;
                while(t!=null){
                    if (t.requireContext){
                        int i = computeContextSize(t,vn);
                        if (i==0){
                            b1 = true;
                            break;
                        }else
                            t.ContextSize=(i);
                    }
                    t = t.nextP;
                }
                if (b1){
                    if (state == FORWARD){
                        state = BACKWARD;
                        currentStep = currentStep.prevS;
                    }else
                        state = END;
                    break;
                }

                if (vn.getCurrentDepth() == -1) {
                    if ( state ==  START)
                         state =  END;
                    else {
                        //vn.pop();
                         state =  BACKWARD;
                        currentStep = currentStep.prevS;
                    }
                } else {
                    vn.push2();
                    vn.toNode(VTDNav.P); // must return true
                    if ((currentStep.nt_eval || currentStep.nt.eval2(vn))
                            && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){
                        if (currentStep.nextS != null) {
                            state =  FORWARD;
                           currentStep = currentStep.nextS;
                        } else {
                            state =  TERMINAL;
                           result = vn.getCurrentIndex2();
                            if ( isUnique(result))
                                return result;
                        }
                    }else{
                        vn.pop2();
                        if (currentStep.hasPredicate)
                            currentStep.resetP(vn);
                        if ( state ==  START)
                             state =  END;
                        else {
                             state =  BACKWARD;
                            currentStep = currentStep.prevS;
                        }
                    }
                }

                break;

            case  END:
                currentStep = null;
                // reset();
                return -1;

            case  BACKWARD:
            case  TERMINAL:
                if (currentStep.prevS == null) {
                    vn.pop2();
                     state =  END;
                    break;
                }else {
                    vn.pop2();
                     state =  BACKWARD;
                    currentStep = currentStep.prevS;
                    break;
                }

            default:
                throw new  XPathEvalException("unknown state");

            }
            return -2;
        }
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:90,代码来源:LocationPathExpr.cs

示例7: evalNodeSet

        public override int evalNodeSet(VTDNav vn)
        {
            switch (opCode)
            {
                case FuncName.CURRENT:
                    if (state == START)
                    {
                        vn.loadCurrentNode();
                        state = END;
                        return vn.getCurrentIndex2();
                    }
                    else
                    {
                        return -1;
                    }
                // break;
                case FuncName.DOCUMENT:
                    if (argCount1 == 1)
                    {
                        if (!argumentList.e.NodeSet)
                        {
                            if (state == START)
                            {
                                String s = argumentList.e.evalString(vn);
                                if (s.Length == 0)
                                {
                                    newVN = xslVN;
                                    newVN.context[0] = -1;
                                }
                                else if (vg.parseFile(s, true))
                                {
                                    newVN = vg.getNav();
                                    newVN.context[0] = -1;
                                    newVN.URIName = s;
                                }
                                else
                                {
                                    state = END;
                                    return -1;
                                }
                                state = END;
                                return 0;
                            }
                            else
                            {
                                return -1;
                            }
                        }
                        else
                        {
                            try
                            {
                                if (state != END)
                                {
                                    a = argumentList.e.evalNodeSet(vn);
                                    if (a != -1)
                                    {
                                        String s = vn.toString(getStringVal(vn, a));
                                        if (s.Length == 0)
                                        {
                                            newVN = xslVN;
                                            newVN.context[0] = -1;
                                        }
                                        else if (vg.parseFile(s, true))
                                        {
                                            newVN = vg.getNav();
                                            newVN.context[0] = -1;
                                            newVN.URIName = s;
                                        }
                                        else
                                        {
                                            state = END;
                                            return -1;
                                        }
                                        state = END;
                                        return 0;
                                    }
                                    else
                                    {
                                        state = END;
                                        return -1;
                                    }
                                }
                                else
                                    return -1;
                            }
                            catch (NavException e)
                            {

                            }
                        }
                    }

                    break;
                case FuncName.KEY:
                    throw new XPathEvalException(" key() not yet implemented ");
                // break;
            }
            throw new XPathEvalException(" Function Expr can't eval to node set ");
        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:100,代码来源:FuncExpr.cs

示例8: generateID

        /**
         * generate-id(nodeset?);
         * @param vn
         * @return
         */
        private String generateID(VTDNav vn)
        {
            if (argCount1 == 0)
            {
                return "v" + vn.getCurrentIndex2();
            }
            else if (argCount1 == 1)
            {
                int i = evalFirstArgumentListNodeSet2(vn);
                return "v" + i;
            }
            else
                throw new ArgumentException
                ("generate-id()'s argument count is invalid");

        }
开发者ID:IgorBabalich,项目名称:vtd-xml,代码行数:21,代码来源:FuncExpr.cs

示例9: getStringLen

        private int getStringLen(VTDNav vn)
        {
            if (argCount1 == 0)
            {
                try
                {
                    if (vn.atTerminal == true)
                    {
                        int type = vn.getTokenType(vn.LN);
                        if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS)
                        {
                            return vn.getStringLength(vn.LN + 1);
                        }
                        else
                        {
                            return vn.getStringLength(vn.LN);
                        }
                    }
                    else
                    {
                        int k = vn.getCurrentIndex2();
                        // int type = vn.getTokenType(k);
                        return vn.XPathStringLength(k);
                    }
                }
                catch (NavException e)
                {
                    return 0;
                }
            }
            else if (argCount1 == 1)
            {
                int result = 0;
                if (argumentList.e.NodeSet)
                {
                    int a = 0x7fffffff, k = -1;
                    vn.push2();
                    int size = vn.contextStack2.size;
                    try
                    {
                        if (argumentList.e.needReordering)
                        {
                            argumentList.e.adjust(vn.getTokenCount());
                            while ((k = argumentList.e.evalNodeSet(vn)) != -1)
                            {
                                if (k < a)
                                    a = k; // a is always smaller
                            }
                            if (a == 0x7fffffff)
                            {
                                a = -1;
                            }
                        }
                        else
                        {
                            a = argumentList.e.evalNodeSet(vn);
                        }
                        if (a == -1)
                            result = 0;
                        else
                        {

                            int type = vn.getTokenType(a);
                            if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS || type == VTDNav.TOKEN_PI_NAME)
                            {
                                result = vn.getStringLength(a + 1);
                            }
                            else if (type == VTDNav.TOKEN_STARTING_TAG || type == VTDNav.TOKEN_DOCUMENT)
                            {
                                result = vn.XPathStringLength(a);
                            }
                            else
                            {
                                result = vn.getStringLength(a);
                            }
                        }
                    }
                    catch (VTDException e)
                    {

                    }
                    argumentList.e.reset(vn);
                    vn.contextStack2.size = size;
                    vn.pop2();
                    return result;
                }
                else
                    return argumentList.e.evalString(vn).Length;
            }
            else
            {
                throw new System.ArgumentException("string-length()'s argument count is invalid");
            }
        }
开发者ID:jzhang2004,项目名称:vtd-xml,代码行数:94,代码来源:FuncExpr.cs


注:本文中的com.ximpleware.VTDNav.getCurrentIndex2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。