/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided. This implementation provides both iterate() and * process() methods natively. */ public int getImplementationMethod() { return operand.getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided. This implementation provides both iterate() and * process() methods natively. */ public int getImplementationMethod() { return operand.getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided directly. The other methods will always be available * indirectly, using an implementation that relies on one of the other methods. * * @return the implementation method, for example {@link #ITERATE_METHOD} or {@link #EVALUATE_METHOD} or * {@link #PROCESS_METHOD} */ @Override public int getImplementationMethod() { return getBaseExpression().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided. This implementation provides both iterate() and * process() methods natively. */ public int getImplementationMethod() { return getBaseExpression().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided directly. The other methods will always be available * indirectly, using an implementation that relies on one of the other methods. * * @return the implementation method, for example {@link #ITERATE_METHOD} or {@link #EVALUATE_METHOD} or * {@link #PROCESS_METHOD} */ @Override public int getImplementationMethod() { return getBaseExpression().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided directly. The other methods will always be available * indirectly, using an implementation that relies on one of the other methods. * * @return the implementation method, for example {@link #ITERATE_METHOD} or {@link #EVALUATE_METHOD} or * {@link #PROCESS_METHOD} */ @Override public int getImplementationMethod() { return getAction().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided directly. The other methods will always be available * indirectly, using an implementation that relies on one of the other methods. * * @return the implementation method, for example {@link #ITERATE_METHOD} or {@link #EVALUATE_METHOD} or * {@link #PROCESS_METHOD} */ @Override public int getImplementationMethod() { return getBaseExpression().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided. This implementation provides both iterate() and * process() methods natively. */ public int getImplementationMethod() { return getBaseExpression().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided directly. The other methods will always be available * indirectly, using an implementation that relies on one of the other methods. * * @return the implementation method, for example {@link #ITERATE_METHOD} or {@link #EVALUATE_METHOD} or * {@link #PROCESS_METHOD} */ @Override public int getImplementationMethod() { return getBaseExpression().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided directly. The other methods will always be available * indirectly, using an implementation that relies on one of the other methods. * * @return the implementation method, for example {@link #ITERATE_METHOD} or {@link #EVALUATE_METHOD} or * {@link #PROCESS_METHOD} */ @Override public int getImplementationMethod() { return getAction().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided directly. The other methods will always be available * indirectly, using an implementation that relies on one of the other methods. * * @return the implementation method, for example {@link #ITERATE_METHOD} or {@link #EVALUATE_METHOD} or * {@link #PROCESS_METHOD} */ @Override public int getImplementationMethod() { return getBaseExpression().getImplementationMethod(); }
/** * An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). * This method indicates which of these methods is provided directly. The other methods will always be available * indirectly, using an implementation that relies on one of the other methods. * * @return the implementation method, for example {@link #ITERATE_METHOD} or {@link #EVALUATE_METHOD} or * {@link #PROCESS_METHOD} */ @Override public int getImplementationMethod() { return getBaseExpression().getImplementationMethod(); }
public int getImplementationMethod() { return getChild().getImplementationMethod(); }
public int getImplementationMethod() { return getChild().getImplementationMethod(); }
/** * Determine the method of evaluation to be used when lazy evaluation of an expression is * preferred. This method is called at compile time, after all optimizations have been done, * to determine the preferred strategy for lazy evaluation, depending on the type of expression. * * @param exp the expression to be evaluated * @return an integer constant identifying the evaluation mode */ public static int eagerEvaluationMode(Expression exp) { if (exp instanceof Literal && !(((Literal)exp).getValue() instanceof Closure)) { return NO_EVALUATION_NEEDED; } if (exp instanceof VariableReference) { return EVALUATE_AND_MATERIALIZE_VARIABLE; } int m = exp.getImplementationMethod(); if ((m & Expression.EVALUATE_METHOD) != 0) { return CALL_EVALUATE_ITEM; } else if ((m & Expression.ITERATE_METHOD) != 0) { return ITERATE_AND_MATERIALIZE; } else { return PROCESS; } }
/** * Determine the method of evaluation to be used when lazy evaluation of an expression is * preferred. This method is called at compile time, after all optimizations have been done, * to determine the preferred strategy for lazy evaluation, depending on the type of expression. * * @param exp the expression to be evaluated * @return an integer constant identifying the evaluation mode */ public static int eagerEvaluationMode(Expression exp) { if (exp instanceof Literal && !(((Literal)exp).getValue() instanceof Closure)) { return NO_EVALUATION_NEEDED; } if (exp instanceof VariableReference) { return EVALUATE_AND_MATERIALIZE_VARIABLE; } int m = exp.getImplementationMethod(); if ((m & Expression.EVALUATE_METHOD) != 0) { return CALL_EVALUATE_ITEM; } else if ((m & Expression.ITERATE_METHOD) != 0) { return ITERATE_AND_MATERIALIZE; } else { return PROCESS; } }
/** * Process the instruction, without returning any tail calls * * @param context The dynamic context, giving access to the current node, * the current variables, etc. * @throws net.sf.saxon.trans.XPathException * if a dynamic error occurs */ public void process(XPathContext context) throws XPathException { int m = getImplementationMethod(); if ((m & EVALUATE_METHOD) != 0) { Item item = evaluateItem(context); if (item != null) { context.getReceiver().append(item, getLocation(), ReceiverOptions.ALL_NAMESPACES); } } else if ((m & ITERATE_METHOD) != 0) { Receiver out = context.getReceiver(); try { iterate(context).forEachOrFail(it -> out.append(it, getLocation(), ReceiverOptions.ALL_NAMESPACES)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); e.maybeSetContext(context); throw e; } } else { throw new AssertionError("process() is not implemented in the subclass " + getClass()); } }
/** * Process the instruction, without returning any tail calls * * @param context The dynamic context, giving access to the current node, * the current variables, etc. * @throws net.sf.saxon.trans.XPathException * if a dynamic error occurs */ public void process(XPathContext context) throws XPathException { int m = getImplementationMethod(); if ((m & EVALUATE_METHOD) != 0) { Item item = evaluateItem(context); if (item != null) { context.getReceiver().append(item, getLocation(), ReceiverOptions.ALL_NAMESPACES); } } else if ((m & ITERATE_METHOD) != 0) { Receiver out = context.getReceiver(); try { iterate(context).forEachOrFail(it -> out.append(it, getLocation(), ReceiverOptions.ALL_NAMESPACES)); } catch (XPathException e) { e.maybeSetLocation(getLocation()); e.maybeSetContext(context); throw e; } } else { throw new AssertionError("process() is not implemented in the subclass " + getClass()); } }
/** * Process the instruction, without returning any tail calls * * @param context The dynamic context, giving access to the current node, * the current variables, etc. */ public void process(XPathContext context) throws XPathException { Expression next = getBaseExpression(); int card = StaticProperty.ALLOWS_ZERO_OR_MORE; if (next instanceof CardinalityChecker) { card = ((CardinalityChecker) next).getRequiredCardinality(); next = ((CardinalityChecker) next).getBaseExpression(); } if ((next.getImplementationMethod() & PROCESS_METHOD) != 0 && !(requiredItemType instanceof DocumentNodeTest)) { Receiver out = context.getReceiver(); TypeCheckingFilter filter = new TypeCheckingFilter(out); filter.setRequiredType(requiredItemType, card, role, getLocation()); context.setReceiver(filter); next.process(context); filter.close(); context.setReceiver(out); } else { // Force pull-mode evaluation super.process(context); } }
/** * Process the instruction, without returning any tail calls * * @param context The dynamic context, giving access to the current node, * the current variables, etc. */ public void process(XPathContext context) throws XPathException { Expression next = operand; ItemType type = Type.ITEM_TYPE; if (next instanceof ItemChecker) { type = ((ItemChecker)next).getRequiredType(); next = ((ItemChecker)next).getBaseExpression(); } if ((next.getImplementationMethod() & PROCESS_METHOD) != 0 && !(type instanceof DocumentNodeTest)) { SequenceReceiver out = context.getReceiver(); TypeCheckingFilter filter = new TypeCheckingFilter(); filter.setUnderlyingReceiver(out); filter.setPipelineConfiguration(out.getPipelineConfiguration()); filter.setRequiredType(type, requiredCardinality, role); context.setReceiver(filter); next.process(context); filter.close(); context.setReceiver(out); } else { super.process(context); } }