/** * Count the number of predicates in the step. * * @param opPos The position of the first predicate the m_opMap array. * * @return The number of predicates for this step. * * @throws TransformerException if a error occurs creating the Expression. */ public int countPredicates(int opPos) throws TransformerException { int count = 0; while (OpCodes.OP_PREDICATE == getOp(opPos)) { count++; opPos = getNextOpPos(opPos); } return count; }
/** * Count the number of predicates in the step. * * @param opPos The position of the first predicate the m_opMap array. * * @return The number of predicates for this step. * * @throws TransformerException if a error occurs creating the Expression. */ public int countPredicates(int opPos) throws TransformerException { int count = 0; while (OpCodes.OP_PREDICATE == getOp(opPos)) { count++; opPos = getNextOpPos(opPos); } return count; }
static boolean functionProximateOrContainsProximate(Compiler compiler, int opPos) { int endFunc = opPos + compiler.getOp(opPos + 1) - 1; opPos = OpMap.getFirstChildPos(opPos); int funcID = compiler.getOp(opPos); // System.out.println("funcID: "+funcID); // System.out.println("opPos: "+opPos); // System.out.println("endFunc: "+endFunc); switch(funcID) { case FunctionTable.FUNC_LAST: case FunctionTable.FUNC_POSITION: return true; default: opPos++; int i = 0; for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++) { int innerExprOpPos = p+2; int argOp = compiler.getOp(innerExprOpPos); boolean prox = isProximateInnerExpr(compiler, innerExprOpPos); if(prox) return true; } } return false; }
static boolean functionProximateOrContainsProximate(Compiler compiler, int opPos) { int endFunc = opPos + compiler.getOp(opPos + 1) - 1; opPos = OpMap.getFirstChildPos(opPos); int funcID = compiler.getOp(opPos); // System.out.println("funcID: "+funcID); // System.out.println("opPos: "+opPos); // System.out.println("endFunc: "+endFunc); switch(funcID) { case FunctionTable.FUNC_LAST: case FunctionTable.FUNC_POSITION: return true; default: opPos++; int i = 0; for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++) { int innerExprOpPos = p+2; int argOp = compiler.getOp(innerExprOpPos); boolean prox = isProximateInnerExpr(compiler, innerExprOpPos); if(prox) return true; } } return false; }
/** * Compiles predicates in the step. * * @param opPos The position of the first predicate the m_opMap array. * @param predicates An empty pre-determined array of * {@link org.apache.xpath.Expression}s, that will be filled in. * * @throws TransformerException */ private void compilePredicates(int opPos, Expression[] predicates) throws TransformerException { for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++) { predicates[i] = predicate(opPos); opPos = getNextOpPos(opPos); } }
/** * Compiles predicates in the step. * * @param opPos The position of the first predicate the m_opMap array. * @param predicates An empty pre-determined array of * {@link org.apache.xpath.Expression}s, that will be filled in. * * @throws TransformerException */ private void compilePredicates(int opPos, Expression[] predicates) throws TransformerException { for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++) { predicates[i] = predicate(opPos); opPos = getNextOpPos(opPos); } }
/** * 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; }
/** * Compile a literal string value. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.objects.XString} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression literal(int opPos) { opPos = getFirstChildPos(opPos); return (XString) getTokenQueue().elementAt(getOp(opPos)); }
/** * Compile a literal number value. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.objects.XNumber} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression numberlit(int opPos) { opPos = getFirstChildPos(opPos); return (XNumber) getTokenQueue().elementAt(getOp(opPos)); }
/** * 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; }
/** * Compile a literal string value. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.objects.XString} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression literal(int opPos) { opPos = getFirstChildPos(opPos); return (XString) getTokenQueue().elementAt(getOp(opPos)); }
/** * Compile a literal number value. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.objects.XNumber} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression numberlit(int opPos) { opPos = getFirstChildPos(opPos); return (XNumber) getTokenQueue().elementAt(getOp(opPos)); }
/** * Compile a variable reference. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Variable} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression variable(int opPos) throws TransformerException { Variable var = new Variable(); opPos = getFirstChildPos(opPos); int nsPos = getOp(opPos); java.lang.String namespace = (OpCodes.EMPTY == nsPos) ? null : (java.lang.String) getTokenQueue().elementAt(nsPos); java.lang.String localname = (java.lang.String) getTokenQueue().elementAt(getOp(opPos+1)); QName qname = new QName(namespace, localname); var.setQName(qname); return var; }
/** * Compile a variable reference. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Variable} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression variable(int opPos) throws TransformerException { Variable var = new Variable(); opPos = getFirstChildPos(opPos); int nsPos = getOp(opPos); java.lang.String namespace = (OpCodes.EMPTY == nsPos) ? null : (java.lang.String) getTokenQueue().elementAt(nsPos); java.lang.String localname = (java.lang.String) getTokenQueue().elementAt(getOp(opPos+1)); QName qname = new QName(namespace, localname); var.setQName(qname); return var; }
static boolean isProximateInnerExpr(Compiler compiler, int opPos) int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op)
static boolean isProximateInnerExpr(Compiler compiler, int opPos) int op = compiler.getOp(opPos); int innerExprOpPos = opPos+2; switch(op)
while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos)))