int analysis = analyze(compiler, firstStepPos, 0); boolean isOneStep = isOneStep(analysis); DTMIterator iter; if (isOneStep && walksSelfOnly(analysis) && isWild(analysis) && !hasPredicate(analysis)) else if (walksChildrenOnly(analysis) && isOneStep) if (isWild(analysis) && !hasPredicate(analysis)) else if (isOneStep && walksAttributes(analysis)) else if(isOneStep && !walksFilteredList(analysis)) if( !walksNamespaces(analysis) && (walksInDocOrder(analysis) || isSet(analysis, BIT_PARENT))) else if (isOptimizableForDescendantIterator(compiler, firstStepPos, 0) if(isNaturalDocOrder(compiler, firstStepPos, 0, analysis))
boolean predAnalysis = analyzePredicate(compiler, stepOpCodePos, stepType);
/** * Tell if the pattern can be 'walked' with the iteration steps in natural * document order, without duplicates. * * @param analysis The general analysis of the pattern. * * @return true if the walk can be done in natural order. * * @throws javax.xml.transform.TransformerException */ static public boolean isNaturalDocOrder(int analysis) { if(canCrissCross(analysis) || isSet(analysis, BIT_NAMESPACE) || walksFilteredList(analysis)) return false; if(walksInDocOrder(analysis)) return true; return false; }
public static boolean canCrissCross(int analysis) { // This could be done faster. Coded for clarity. if(walksSelfOnly(analysis)) return false; else if(walksDownOnly(analysis) && !canSkipSubtrees(analysis)) return false; else if(walksChildrenAndExtraAndSelfOnly(analysis)) return false; else if(walksDescendantsAndExtraAndSelfOnly(analysis)) return false; else if(walksUpOnly(analysis)) return false; else if(walksExtraNodesOnly(analysis)) return false; else if(walksSubtree(analysis) && (walksSideways(analysis) || walksUp(analysis) || canSkipSubtrees(analysis))) return true; else return false; }
if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true;
StepPattern step = null; StepPattern firstStep = null, prevStep = null; int analysis = analyze(compiler, stepOpCodePos, stepIndex); step = createDefaultStepPattern(compiler, stepOpCodePos, mpi, analysis, firstStep, prevStep); if(isDownwardAxisOfMany(axis))
AxesWalker walker, prevWalker = null; int analysis = analyze(compiler, stepOpCodePos, stepIndex); walker = createDefaultWalker(compiler, stepOpCodePos, lpi, analysis);
/** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { int axis = getAxis(); int bit = WalkerFactory.getAnalysisBitFromAxes(axis); return bit; }
public static void diagnoseIterator(String name, int analysis, Compiler compiler) { System.out.println(compiler.toString()+", "+name+", " + Integer.toBinaryString(analysis) + ", " + getAnalysisString(analysis)); }
/** * Create a OneStepIterator object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * * @throws javax.xml.transform.TransformerException */ OneStepIterator(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis); int firstStepPos = OpMap.getFirstChildPos(opPos); m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos); }
/** * This method is for building an array of possible levels * where the target element(s) could be found for a match. * @param lpi The owning location path iterator. * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * * @return non-null AxesWalker derivative. * * @throws javax.xml.transform.TransformerException * @xsl.usage advanced */ static AxesWalker loadOneWalker( WalkingIterator lpi, Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { AxesWalker firstWalker = null; int stepType = compiler.getOp(stepOpCodePos); if (stepType != OpCodes.ENDOP) { // m_axesWalkers = new AxesWalker[1]; // As we unwind from the recursion, create the iterators. firstWalker = createDefaultWalker(compiler, stepType, lpi, 0); firstWalker.init(compiler, stepOpCodePos, stepType); } return firstWalker; }
throws javax.xml.transform.TransformerException if(canCrissCross(analysis)) return false; if(isSet(analysis, BIT_NAMESPACE)) return false; if(isSet(analysis, BIT_FOLLOWING | BIT_FOLLOWING_SIBLING) && isSet(analysis, BIT_PRECEDING | BIT_PRECEDING_SIBLING)) return false;
public static boolean canCrissCross(int analysis) { // This could be done faster. Coded for clarity. if(walksSelfOnly(analysis)) return false; else if(walksDownOnly(analysis) && !canSkipSubtrees(analysis)) return false; else if(walksChildrenAndExtraAndSelfOnly(analysis)) return false; else if(walksDescendantsAndExtraAndSelfOnly(analysis)) return false; else if(walksUpOnly(analysis)) return false; else if(walksExtraNodesOnly(analysis)) return false; else if(walksSubtree(analysis) && (walksSideways(analysis) || walksUp(analysis) || canSkipSubtrees(analysis))) return true; else return false; }
StepPattern step = null; StepPattern firstStep = null, prevStep = null; int analysis = analyze(compiler, stepOpCodePos, stepIndex); step = createDefaultStepPattern(compiler, stepOpCodePos, mpi, analysis, firstStep, prevStep); if(isDownwardAxisOfMany(axis))
if(isProximateInnerExpr(compiler, innerExprOpPos)) return true; break; break; // OK case OpCodes.OP_FUNCTION: boolean isProx = functionProximateOrContainsProximate(compiler, opPos); if(isProx) return true; int leftPos = OpMap.getFirstChildPos(op); int rightPos = compiler.getNextOpPos(leftPos); isProx = isProximateInnerExpr(compiler, leftPos); if(isProx) return true; isProx = isProximateInnerExpr(compiler, rightPos); if(isProx) return true;
AxesWalker walker, prevWalker = null; int analysis = analyze(compiler, stepOpCodePos, stepIndex); walker = createDefaultWalker(compiler, stepOpCodePos, lpi, analysis);
/** * Get the analysis bits for this walker, as defined in the WalkerFactory. * @return One of WalkerFactory#BIT_DESCENDANT, etc. */ public int getAnalysisBits() { int axis = getAxis(); int bit = WalkerFactory.getAnalysisBitFromAxes(axis); return bit; }
public static void diagnoseIterator(String name, int analysis, Compiler compiler) { System.out.println(compiler.toString()+", "+name+", " + Integer.toBinaryString(analysis) + ", " + getAnalysisString(analysis)); }
/** * Create a OneStepIterator object. * * @param compiler A reference to the Compiler that contains the op map. * @param opPos The position within the op map, which contains the * location path expression for this itterator. * * @throws javax.xml.transform.TransformerException */ OneStepIteratorForward(Compiler compiler, int opPos, int analysis) throws javax.xml.transform.TransformerException { super(compiler, opPos, analysis); int firstStepPos = OpMap.getFirstChildPos(opPos); m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos); }
/** * This method is for building an array of possible levels * where the target element(s) could be found for a match. * @param lpi The owning location path iterator. * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param stepOpCodePos The opcode position for the step. * * @return non-null AxesWalker derivative. * * @throws javax.xml.transform.TransformerException * @xsl.usage advanced */ static AxesWalker loadOneWalker( WalkingIterator lpi, Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { AxesWalker firstWalker = null; int stepType = compiler.getOp(stepOpCodePos); if (stepType != OpCodes.ENDOP) { // m_axesWalkers = new AxesWalker[1]; // As we unwind from the recursion, create the iterators. firstWalker = createDefaultWalker(compiler, stepType, lpi, 0); firstWalker.init(compiler, stepOpCodePos, stepType); } return firstWalker; }