protected selectElement_D ( System en ) : void | ||
en | System | /// |
return | void |
public int computeContextSize(Predicate p, VTDNav vn){ bool b = false; Predicate tp = null; int i = 0; AutoPilot ap; switch(currentStep.axis_type){ case AxisType.CHILD: if (currentStep.nt.testType != NodeTest.TEXT){ b = vn.toElement(VTDNav.FIRST_CHILD); if (b) { do { if (currentStep.eval(vn, p)) { i++; } } while (vn.toElement(VTDNav.NS)); vn.toElement(VTDNav.PARENT); currentStep.resetP(vn,p); return i; } else return 0; }else { TextIter ti = new TextIter(); ti.touch(vn); while((ti.getNext())!=-1){ if (currentStep.evalPredicates(vn,p)){ i++; } } currentStep.resetP(vn,p); return i; } case AxisType.DESCENDANT_OR_SELF: case AxisType.DESCENDANT: case AxisType.PRECEDING: case AxisType.FOLLOWING: String helper = null; if (currentStep.nt.testType == NodeTest.NODE){ helper = "*"; }else { helper = currentStep.nt.nodeName; } ap = new AutoPilot(vn); if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF ) if (currentStep.nt.testType == NodeTest.NODE) ap.Special = true; else ap.Special = false; //currentStep.o = ap = new AutoPilot(vn); if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF) if (currentStep.nt.localName!=null) ap.selectElementNS(currentStep.nt.URL,currentStep.nt.localName); else ap.selectElement(helper); else if (currentStep.axis_type == AxisType.DESCENDANT) if (currentStep.nt.localName!=null) ap.selectElementNS_D(currentStep.nt.URL,currentStep.nt.localName); else ap.selectElement_D(helper); else if (currentStep.axis_type == AxisType.PRECEDING) if (currentStep.nt.localName!=null) ap.selectElementNS_P(currentStep.nt.URL,currentStep.nt.localName); else ap.selectElement_P(helper); else if (currentStep.nt.localName!=null) ap.selectElementNS_F(currentStep.nt.URL,currentStep.nt.localName); else ap.selectElement_F(helper); vn.push2(); while(ap.iterate()){ if (currentStep.evalPredicates(vn,p)){ i++; } } vn.pop2(); currentStep.resetP(vn,p); return i; case AxisType.PARENT: vn.push2(); i = 0; if (vn.toElement(VTDNav.PARENT)){ if (currentStep.eval(vn,p)){ i++; } } vn.pop2(); currentStep.resetP(vn,p); return i; case AxisType.ANCESTOR: vn.push2(); i = 0; while (vn.toElement(VTDNav.PARENT)) { if (currentStep.eval(vn, p)) { i++; } } vn.pop2(); currentStep.resetP(vn,p); return i; case AxisType.ANCESTOR_OR_SELF: vn.push2(); i = 0; do { if (currentStep.eval(vn, p)) { i++; } }while(vn.toElement(VTDNav.PARENT)); vn.pop2(); currentStep.resetP(vn,p); return i; case AxisType.SELF: i = 0; if (vn.toElement(VTDNav.PARENT)){ if (currentStep.eval(vn,p)){ i++; } } currentStep.resetP(vn,p); return i; case AxisType.FOLLOWING_SIBLING: vn.push2(); while(vn.toElement(VTDNav.NEXT_SIBLING)){ if (currentStep.eval(vn,p)){ i++; } } vn.pop2(); currentStep.resetP(vn,p); return i; case AxisType.PRECEDING_SIBLING: vn.push2(); while(vn.toElement(VTDNav.PREV_SIBLING)){ if (currentStep.eval(vn,p)){ i++; } } vn.pop2(); currentStep.resetP(vn,p); return i; case AxisType.ATTRIBUTE: ap = new AutoPilot(vn); if (currentStep.nt.localName!=null) ap.selectAttrNS(currentStep.nt.URL, currentStep.nt.localName); else ap.selectAttr(currentStep.nt.nodeName); i = 0; while(ap.iterateAttr()!=-1){ if (currentStep.evalPredicates(vn,p)){ i++; } } currentStep.resetP(vn,p); return i; default: throw new XPathEvalException("axis not supported"); } //return 8; }