net.sf.saxon.expr

Class Atomizer

public final class Atomizer extends UnaryExpression

An Atomizer is an expression corresponding essentially to the fn:data() function: it maps a sequence by replacing nodes with their typed values
Nested Class Summary
static classAtomizer.AtomizingFunction
Implement the mapping function.
Constructor Summary
Atomizer(Expression sequence, Configuration config)
Constructor
Method Summary
intcomputeCardinality()
Determine the static cardinality of the expression
intcomputeSpecialProperties()
Determine the special properties of this expression
protected StringdisplayOperator(NamePool pool)
Give a string representation of the operator for use in diagnostics
ItemevaluateItem(XPathContext context)
Evaluate as an Item.
static ItemTypegetAtomizedItemType(Expression operand, boolean alwaysUntyped, TypeHierarchy th)
Compute the type that will result from atomizing the result of a given expression
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression, if possible
SequenceIteratoriterate(XPathContext context)
Iterate over the sequence of values
Expressionsimplify(StaticContext env)
Simplify an expression
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)
Type-check the expression

Constructor Detail

Atomizer

public Atomizer(Expression sequence, Configuration config)
Constructor

Parameters: sequence the sequence to be atomized config the Configuration. Used only for optimization, may be null. Atomization is faster if it is known in advance that all nodes will be untyped.

Method Detail

computeCardinality

public int computeCardinality()
Determine the static cardinality of the expression

computeSpecialProperties

public int computeSpecialProperties()
Determine the special properties of this expression

Returns: NON_CREATIVE.

displayOperator

protected String displayOperator(NamePool pool)
Give a string representation of the operator for use in diagnostics

Returns: the operator, as a string

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate as an Item. This should only be called if the Atomizer has cardinality zero-or-one, which will only be the case if the underlying expression has cardinality zero-or-one.

getAtomizedItemType

public static final ItemType getAtomizedItemType(Expression operand, boolean alwaysUntyped, TypeHierarchy th)
Compute the type that will result from atomizing the result of a given expression

Parameters: operand the given expression alwaysUntyped true if it is known that nodes will always be untyped

Returns: the item type of the result of evaluating the operand expression, after atomization

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression, if possible

Parameters: th

Returns: a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER. For this class, the result is always an atomic type, but it might be more specific.

iterate

public SequenceIterator iterate(XPathContext context)
Iterate over the sequence of values

simplify

public Expression simplify(StaticContext env)
Simplify an expression

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)
Type-check the expression