/** * Offer promotion for this subexpression. The offer will be accepted if the subexpression * is not dependent on the factors (e.g. the context item) identified in the PromotionOffer. * By default the offer is not accepted - this is appropriate in the case of simple expressions * such as constant values and variable references where promotion would give no performance * advantage. This method is always called at compile time. * * @param offer details of the offer, for example the offer to move * expressions that don't depend on the context to an outer level in * the containing expression * @return if the offer is not accepted, return this expression unchanged. * Otherwise return the result of rewriting the expression to promote * this subexpression * @throws net.sf.saxon.trans.XPathException * if any error is detected */ public Expression promote(PromotionOffer offer) throws XPathException { Expression exp = offer.accept(this); if (exp != null) { return exp; } else { operand = doPromotion(operand, offer); return this; } }
/** * Offer promotion for this subexpression. The offer will be accepted if the subexpression * is not dependent on the factors (e.g. the context item) identified in the PromotionOffer. * By default the offer is not accepted - this is appropriate in the case of simple expressions * such as constant values and variable references where promotion would give no performance * advantage. This method is always called at compile time. * * @param offer details of the offer, for example the offer to move * expressions that don't depend on the context to an outer level in * the containing expression * @return if the offer is not accepted, return this expression unchanged. * Otherwise return the result of rewriting the expression to promote * this subexpression * @throws net.sf.saxon.trans.XPathException * if any error is detected */ public Expression promote(PromotionOffer offer) throws XPathException { Expression exp = offer.accept(this); if (exp != null) { return exp; } else { operand = doPromotion(operand, offer); return this; } }