net.sf.saxon.functions

Class IntegratedFunctionCall

public class IntegratedFunctionCall extends FunctionCall

Expression representing a call to a user-written extension function implemented as a subtype of ExtensionFunctionCall
Constructor Summary
IntegratedFunctionCall(ExtensionFunctionCall function)
Method Summary
voidcheckArguments(ExpressionVisitor visitor)
Method called during static type checking
protected intcomputeCardinality()
Compute the static cardinality of this expression
protected intcomputeSpecialProperties()
Compute the special properties of this expression.
Expressioncopy()
Copy an expression.
booleaneffectiveBooleanValue(XPathContext context)
Get the effective boolean value of the expression.
ExtensionFunctionCallgetFunction()
Get the underlying IntegratedFunction
intgetIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions.
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the expression, if possible.
SequenceIteratoriterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.
ExpressionpreEvaluate(ExpressionVisitor visitor)
Pre-evaluate a function at compile time.
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression.

Constructor Detail

IntegratedFunctionCall

public IntegratedFunctionCall(ExtensionFunctionCall function)

Method Detail

checkArguments

public void checkArguments(ExpressionVisitor visitor)
Method called during static type checking

computeCardinality

protected int computeCardinality()
Compute the static cardinality of this expression

Returns: the computed cardinality, as one of the values ALLOWS_ZERO_OR_ONE, EXACTLY_ONE, ALLOWS_ONE_OR_MORE, ALLOWS_ZERO_OR_MORE

computeSpecialProperties

protected int computeSpecialProperties()
Compute the special properties of this expression. These properties are denoted by a bit-significant integer, possible values are in class StaticProperty. The "special" properties are properties other than cardinality and dependencies, and most of them relate to properties of node sequences, for example whether the nodes are in document order.

Returns: the special properties, as a bit-significant integer

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

effectiveBooleanValue

public boolean effectiveBooleanValue(XPathContext context)
Get the effective boolean value of the expression. This returns false if the value is the empty sequence, a zero-length string, a number equal to zero, or the boolean false. Otherwise it returns true.

Parameters: context The context in which the expression is to be evaluated

Returns: the effective boolean value

Throws: net.sf.saxon.trans.XPathException if any dynamic error occurs evaluating the expression

getFunction

public ExtensionFunctionCall getFunction()
Get the underlying IntegratedFunction

getIntrinsicDependencies

public int getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. For example, position() has an intrinsic dependency on the context position, while (position()+1) does not. The default implementation of the method returns 0, indicating "no dependencies".

Returns: a set of bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression, if possible. All expression return sequences, in general; this method determines the type of the items within the sequence, assuming that (a) this is known in advance, and (b) it is the same for all items in the sequence.

This method should always return a result, though it may be the best approximation that is available at the time.

Parameters: th the type hierarchy cache

Returns: a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)

iterate

public SequenceIterator iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.

Parameters: context supplies the context for evaluation

Returns: a SequenceIterator that can be used to iterate over the result of the expression

Throws: net.sf.saxon.trans.XPathException if any dynamic error occurs evaluating the expression

preEvaluate

public Expression preEvaluate(ExpressionVisitor visitor)
Pre-evaluate a function at compile time. Functions that do not allow pre-evaluation, or that need access to context information, can override this method.

Parameters: visitor an expression visitor

Returns: the result of the early evaluation, or the original expression, or potentially a simplified expression

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression.