/** * Determine whether this is a vacuous expression as defined in the XQuery update specification * * @return true if this expression is vacuous */ public boolean isVacuousExpression() { return getAction().isVacuousExpression(); }
/** * Check that any elements and attributes constructed or returned by this expression are acceptable * in the content model of a given complex type. It's always OK to say yes, since the check will be * repeated at run-time. The process of checking element and attribute constructors against the content * model of a complex type also registers the type of content expected of those constructors, so the * static validation can continue recursively. */ public void checkPermittedContents(SchemaType parentType, boolean whole) throws XPathException { getAction().checkPermittedContents(parentType, whole); }
/** * 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(); }
/** * Determine the data type of the items returned by the expression, if possible * * @return one of the values Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, * or Type.ITEM (meaning not known in advance) */ /*@NotNull*/ public ItemType getItemType() { return getAction().getItemType(); }
/** * Determine the static cardinality of the expression */ public int computeCardinality() { return getAction().getCardinality(); }
/** * Mark tail function calls */ public int markTailFunctionCalls(StructuredQName qName, int arity) { return ExpressionTool.markTailFunctionCalls(getAction(), qName, arity); }
/** * Determine the data type of the items returned by the expression, if possible * * @return one of the values Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, * or Type.ITEM (meaning not known in advance) */ /*@NotNull*/ public ItemType getItemType() { return getAction().getItemType(); }
/** * Determine the static cardinality of the expression */ public int computeCardinality() { return getAction().getCardinality(); }
/** * Determine whether this is a vacuous expression as defined in the XQuery update specification * * @return true if this expression is vacuous */ public boolean isVacuousExpression() { return getAction().isVacuousExpression(); }
/** * Check that any elements and attributes constructed or returned by this expression are acceptable * in the content model of a given complex type. It's always OK to say yes, since the check will be * repeated at run-time. The process of checking element and attribute constructors against the content * model of a complex type also registers the type of content expected of those constructors, so the * static validation can continue recursively. */ public void checkPermittedContents(SchemaType parentType, boolean whole) throws XPathException { getAction().checkPermittedContents(parentType, whole); }
/** * 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(); }
/** * Mark tail function calls */ public int markTailFunctionCalls(StructuredQName qName, int arity) { return ExpressionTool.markTailFunctionCalls(getAction(), qName, arity); }
/** * Get the static type of the expression as a UType, following precisely the type * inference rules defined in the XSLT 3.0 specification. * * @return the static item type of the expression according to the XSLT 3.0 defined rules * @param contextItemType the type of the context item */ @Override public UType getStaticUType(UType contextItemType) { if (isInstruction()) { return UType.ANY; } return getAction().getStaticUType(contextItemType); }
/** * The toString() method for an expression attempts to give a representation of the expression * in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. * In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax * * @return a representation of the expression as a string */ public String toString() { return "let $" + getVariableEQName() + " := " + getSequence() + " return " + ExpressionTool.parenthesize(getAction()); }
/** * Return the estimated cost of evaluating an expression. This is a very crude measure based * on the syntactic form of the expression (we have no knowledge of data values). We take * the cost of evaluating a simple scalar comparison or arithmetic expression as 1 (one), * and we assume that a sequence has length 5. The resulting estimates may be used, for * example, to reorder the predicates in a filter expression so cheaper predicates are * evaluated first. */ @Override public int getCost() { return getSequence().getCost() + getAction().getCost(); }
/** * Return the estimated cost of evaluating an expression. This is a very crude measure based * on the syntactic form of the expression (we have no knowledge of data values). We take * the cost of evaluating a simple scalar comparison or arithmetic expression as 1 (one), * and we assume that a sequence has length 5. The resulting estimates may be used, for * example, to reorder the predicates in a filter expression so cheaper predicates are * evaluated first. */ @Override public int getCost() { return getSequence().getCost() + getAction().getCost(); }
/** * The toString() method for an expression attempts to give a representation of the expression * in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. * In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax * * @return a representation of the expression as a string */ public String toString() { return "let $" + getVariableEQName() + " := " + getSequence() + " return " + ExpressionTool.parenthesize(getAction()); }
/** * Get the static properties of this expression (other than its type). The result is * bit-signficant. These properties are used for optimizations. In general, if * property bit is set, it is true, but if it is unset, the value is unknown. */ public int computeSpecialProperties() { int props = getAction().getSpecialProperties(); int seqProps = getSequence().getSpecialProperties(); if ((seqProps & StaticProperty.NO_NODES_NEWLY_CREATED) == 0) { props &= ~StaticProperty.NO_NODES_NEWLY_CREATED; } return props; }
/** * Get the static properties of this expression (other than its type). The result is * bit-signficant. These properties are used for optimizations. In general, if * property bit is set, it is true, but if it is unset, the value is unknown. */ public int computeSpecialProperties() { int props = getAction().getSpecialProperties(); int seqProps = getSequence().getSpecialProperties(); if ((seqProps & StaticProperty.NO_NODES_NEWLY_CREATED) == 0) { props &= ~StaticProperty.NO_NODES_NEWLY_CREATED; } return props; }
public AbstractExpression exprFor (LetExpression let) { StructuredQName var = let.getVariableQName(); Expression seq = let.getSequence(); Expression returns = let.getAction(); return new FLWOR(exprFor(returns), new LetClause (new Variable(qnameFor(var), getTypeDescription(let.getRequiredType())), exprFor(seq))); }