net.sf.saxon.expr

Class AtomicSequenceConverter

public final class AtomicSequenceConverter extends UnaryExpression implements MappingExpression

An AtomicSequenceConverter is an expression that performs a cast on each member of a supplied sequence
Constructor Summary
AtomicSequenceConverter(Expression sequence, AtomicType requiredItemType)
Constructor
Method Summary
intcomputeCardinality()
Determine the static cardinality of the expression
intcomputeSpecialProperties()
Determine the special properties of this expression
Expressioncopy()
Copy an expression.
booleanequals(Object other)
Is this expression the same as another expression?
ItemevaluateItem(XPathContext context)
Evaluate as an Item.
voidexplain(ExpressionPresenter destination)
Diagnostic print of expression structure.
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression, if possible
SequenceIteratorgetMappingIterator(SequenceIterator base, XPathContext context)
AtomicTypegetRequiredPrimitiveType()
Get the required (target) primitive type
SequenceIteratoriterate(XPathContext context)
Iterate over the sequence of values
Expressionsimplify(ExpressionVisitor visitor)
Simplify an expression
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Constructor Detail

AtomicSequenceConverter

public AtomicSequenceConverter(Expression sequence, AtomicType requiredItemType)
Constructor

Parameters: sequence this must be a sequence of atomic values. This is not checked; a ClassCastException will occur if the precondition is not satisfied. requiredItemType the item type to which all items in the sequence should be converted, using the rules for "cast as".

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.

copy

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

Returns: the copy of the original expression

equals

public boolean equals(Object other)
Is this expression the same as another expression?

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate as an Item. This should only be called if the AtomicSequenceConverter has cardinality zero-or-one

explain

public void explain(ExpressionPresenter destination)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

getItemType

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

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 in advance)

getMappingIterator

public SequenceIterator getMappingIterator(SequenceIterator base, XPathContext context)

getRequiredPrimitiveType

public AtomicType getRequiredPrimitiveType()
Get the required (target) primitive type

Returns: the required primitive type

iterate

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

simplify

public Expression simplify(ExpressionVisitor visitor)
Simplify an expression

Parameters: visitor an expression visitor

typeCheck

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