if (currentStep.getNextStep() != null){ vn.LN = result; state =  FORWARD; currentStep = currentStep.getNextStep(); } else { state =  TERMINAL;  if ( isUnique(result)){  vn.LN = result; return result; } } }else { state = END;
vn.LN = result; t = currentStep.p; while(t!=null){ if (t.requireContextSize()){ t.setContextSize(1); } t = t.nextP; } state = END; if (currentStep.evalPredicates(vn)) { if (currentStep.getNextStep() != null) { vn.LN = result; state = FORWARD; currentStep = currentStep.getNextStep(); } else { state = TERMINAL;  if (isUnique(result)) {  vn.LN = result; return result; } } }  } else { state = END;
		private final int process_child(VTDNav vn)throws XPathEvalException,NavException{		    int result;		    boolean b = false, b1 = false;		    int contextSize;		    Predicate t= null;		    		    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.requireContextSize()){		    	                int i = computeContextSize(t,vn);		    	                if (i==0){		    	                    b1 = true;		    	                    break;		    	                }else		    	                    t.setContextSize(i);		    	            }		    	            t = t.nextP;		    	        }		    	        if (b1){		    	            state = END;		    	            break;		    	        }		    	        						 b=vn.toElement(VTDNav.FIRST_CHILD);						 state =  END;						 if (b == true){						 do {							if (currentStep.eval(vn)) {								if (currentStep.getNextStep() != null){									//currentStep.position++;									 state =  FORWARD;									currentStep = currentStep.getNextStep();								}								else {									 state =  TERMINAL;									result = vn.getCurrentIndex();									if ( isUnique(result)){										return result;									}								}							break;							}						} while (vn.toElement(VTDNav.NS));						if (state == END)						    vn.toElement(VTDNav.PARENT);					 }		    	    }else {						if (vn.getAtTerminal()==true){							state = END;						}else {							result = vn.getText();							if (result != -1){								vn.setAtTerminal(true);								if (currentStep.getNextStep() != null){								    vn.LN = result;									state =  FORWARD;									currentStep = currentStep.getNextStep();								} else {									state =  TERMINAL;									//result = vn.getText();									if ( isUnique(result)){										//vn.setAtTerminal(true);									    vn.LN = result;										return result;									}								}												}else {															state = END;														}						}		    	        		    	    }		    	    break;		    	case END:					currentStep =null;					// reset();					return -1;							    	case FORWARD:		    	    if (currentStep.nt.testType != NodeTest.TEXT){		    	        t = currentStep.p;		    	        while(t!=null){		    	            if (t.requireContextSize()){		    	                int i = computeContextSize(t,vn);		    	                if (i==0){		    	                    b1 = true;		    	                    break;		    	                }else		    	                    t.setContextSize(i);		    	            }		    	            t = t.nextP;		    	        }		    	        if (b1){		    	            currentStep = currentStep.getPrevStep();		    	            state = BACKWARD;		    	            break;		    	        }		    	        		   			 	state =  BACKWARD;		   			 	forward: if (vn.toElement(VTDNav.FC)) {							do {								if (currentStep.eval(vn)) {									if (currentStep.getNextStep() != null) {										 state =  FORWARD;										currentStep = currentStep.getNextStep();									} else {										 state =  TERMINAL;										result = vn.getCurrentIndex();										if ( isUnique(result))											return result;									}									break forward;								}							} while (vn.toElement(VTDNav.NS));							vn.toElement(VTDNav.P);							currentStep.resetP(vn);							currentStep = currentStep.getPrevStep();						} else {							//vn.toElement(VTDNav.P);							currentStep = currentStep.getPrevStep();						}			    	}else {			    	    // predicate at an attribute is not evaled						if (vn.getAtTerminal() == true){							state = BACKWARD;							currentStep = currentStep.getPrevStep();						}else {							result = vn.getText();							if (result != -1){								vn.setAtTerminal(true);								if (currentStep.getNextStep() != null){								    vn.LN = result;									state =  FORWARD;									currentStep = currentStep.getNextStep();								} else {									state =  TERMINAL;									//result = vn.getText();									if (isUnique(result)){									    vn.LN = result;										return result;									}								}												}else {									state = BACKWARD;									currentStep = currentStep.getPrevStep();							}						}				    	        			    	}		    	    break;		    			    	case BACKWARD:					if (currentStep.nt.testType != NodeTest.TEXT) {						//currentStep = currentStep.getPrevStep();						b = false;						while (vn.toElement(VTDNav.NS)) {							if (currentStep.eval(vn)) {								b = true;								break;							}						}						if (b == true) {							 state =  FORWARD;							currentStep = currentStep.getNextStep();						} else if (currentStep.getPrevStep() == null){							currentStep.resetP(vn);							vn.toElement(VTDNav.P);							 state =  END;						}						else {							currentStep.resetP(vn);							 state =  BACKWARD;							vn.toElement(VTDNav.P);							currentStep = currentStep.getPrevStep();						}					}else {						vn.setAtTerminal(false);						if (currentStep.getPrevStep() == null)							 state =  END;						else {							 state =  BACKWARD;							 //vn.setAtTerminal(false);							currentStep = currentStep.getPrevStep();						}					}					break;		    	    		    	case TERMINAL:					if (currentStep.nt.testType != NodeTest.TEXT) {						while (vn.toElement(VTDNav.NS)) {							if (currentStep.eval(vn)) {								// state =  TERMINAL;								result = vn.getCurrentIndex();								if ( isUnique(result))									return result;							}						}						currentStep.resetP(vn);						if (currentStep.getPrevStep() == null){							 state =  END;							 vn.toElement(VTDNav.P);						}						else {							vn.toElement(VTDNav.P);														 state =  BACKWARD;							currentStep = currentStep.getPrevStep();						}					}else {						currentStep.resetP(vn);						vn.setAtTerminal(false);						if (currentStep.getPrevStep() == null)							 state =  END;						else {							 state =  BACKWARD;							currentStep = currentStep.getPrevStep();						}					}					break;				default:					throw new XPathEvalException("unknown state");		    }		    return -2;		}